Get Free Trial
  1. API reference
    1. Introduction
    2. Flexmonster()
  2. Objects
    1. All objects
    2. ReportObject
    3. DataSourceObject
    4. MappingObject
    5. SliceObject
    6. OptionsObject
    7. GlobalObject
    8. Filtering
      1. FilterObject
      2. NumberQueryObject
      3. StringQueryObject
      4. DateQueryObject
      5. TimeQueryObject
      6. ValueQueryObject
    9. FormatObject
    10. ConditionalFormatObject
    11. TableSizesObject
    12. CellDataObject
    13. ChartDataObject
    14. ToolbarObject
    15. ChartLegendDataObject
    16. ShareReportConnectionObject
  3. Methods
    1. All methods
    2. addCalculatedMeasure
    3. addCondition
    4. alert
    5. clear
    6. clearFilter
    7. clearXMLACache
    8. closeFieldsList
    9. collapseAllData
    10. collapseCell
    11. collapseData
    12. connectTo
    13. customizeAPIRequest
    14. customizeCell
    15. customizeChartElement
    16. customizeContextMenu
    17. dispose
    18. drillDownCell
    19. drillUpCell
    20. expandAllData
    21. expandCell
    22. expandData
    23. exportTo
    24. getAllConditions
    25. getAllHierarchies
    26. getAllHierarchiesAsync
    27. getAllMeasures
    28. getAllMeasuresAsync
    29. getCell
    30. getColumns
    31. getColumnsAsync
    32. getCondition
    33. getFilter
    34. getFlatSort
    35. getFormat
    36. getMeasures
    37. getMeasuresAsync
    38. getMembers
    39. getMembersAsync
    40. getOptions
    41. getReport
    42. getReportFilters
    43. getReportFiltersAsync
    44. getRows
    45. getRowsAsync
    46. getSelectedCell
    47. getSort
    48. getTableSizes
    49. getXMLACatalogs
    50. getXMLACatalogsAsync
    51. getXMLACubes
    52. getXMLACubesAsync
    53. getXMLADataSources
    54. getXMLADataSourcesAsync
    55. getXMLAProviderName
    56. getXMLAProviderNameAsync
    57. load
    58. off
    59. on
    60. open
    61. openCalculatedValueEditor
    62. openFieldsList
    63. openFilter
    64. print
    65. refresh
    66. removeAllCalculatedMeasures
    67. removeAllConditions
    68. removeCalculatedMeasure
    69. removeCondition
    70. removeSelection
    71. runQuery
    72. save
    73. scrollToColumn
    74. scrollToRow
    75. setFilter
    76. setFlatSort
    77. setFormat
    78. setOptions
    79. setReport
    80. setSort
    81. setTableSizes
    82. shareReport
    83. showCharts
    84. showGrid
    85. showGridAndCharts
    86. sortingMethod
    87. sortValues
    88. updateData
  4. Events
    1. All events
    2. afterchartdraw
    3. aftergriddraw
    4. beforegriddraw
    5. beforetoolbarcreated
    6. cellclick
    7. celldoubleclick
    8. chartclick
    9. datachanged
    10. dataerror
    11. datafilecancelled
    12. dataloaded
    13. drillthroughclose
    14. drillthroughopen
    15. exportcomplete
    16. exportstart
    17. fieldslistclose
    18. fieldslistopen
    19. filterclose
    20. filteropen
    21. loadingdata
    22. loadinglocalization
    23. loadingolapstructure
    24. loadingreportfile
    25. localizationerror
    26. localizationloaded
    27. olapstructureerror
    28. olapstructureloaded
    29. openingreportfile
    30. printcomplete
    31. printstart
    32. querycomplete
    33. queryerror
    34. ready
    35. reportchange
    36. reportcomplete
    37. reportfilecancelled
    38. reportfileerror
    39. runningquery
    40. unauthorizederror
    41. update
  5. Custom data source API
    1. All requests
    2. /handshake request
    3. /fields request
    4. /members request
    5. /select request for the pivot table
    6. /select request for the flat table
    7. /select request for the drill-through view
    8. FieldObject
    9. FilterObject
    10. FilterGroupObject
  6. MongoDB Connector API
    1. All methods
    2. getSchema
    3. getMembers
    4. getSelectResult
  7. Flexmonster Connector for amCharts
    1. All methods
    2. amcharts.getData
    3. amcharts.getCategoryName
    4. amcharts.getMeasureNameByIndex
    5. amcharts.getNumberOfMeasures
    6. amcharts.getNumberFormatPattern
Table of contents


The data source is a required part of the ReportObject.

Flexmonster supports data from OLAP data sources, Elasticsearch, SQL databases, MongoDB databases, the custom data source API, CSV and JSON static files, and inline JSON data. Each data source requires specific properties to be set inside the dataSource section of the ReportObject.

For more details on the DataSourceObject usage, refer to this tutorial with examples: Data source.

Here is a list of all available properties for a dataSource:

  • mapping (optional) – MappingObject | String. Allows defining field data types, captions, multilevel hierarchies, grouping fields under separate dimensions, and setting other view configurations of hierarchies. It can be either the inline MappingObject or the URL to a JSON file with mapping. See an example on JSFiddle.
  • binary (optional) – Boolean. Flag to use Data Speed Accelerator instead of XMLA protocol. Only for the "microsoft analysis services" data source type.
  • browseForFile (optional) – Boolean. Only for "csv" and "json" data source types. Defines whether you want to load a file from the local file system (true) or not (false). Default value: false.
  • catalog (optional) – String. The data source catalog name of the OLAP data source. Only for the "microsoft analysis services" data source type.
  • cube (optional) – String. The given catalog’s cube’s name of the OLAP data source. Only for the "microsoft analysis services" data source type.
  • data (optional) – JSON. A property to set JSON data if it is already on the page.
  • dataSourceInfo (optional) – String. The service info of the OLAP data source. Only for the "microsoft analysis services" data source type.
  • type (optional) – String. Type of data source. The component supports the following types: "json", "csv", "api", "microsoft analysis services", and "elasticsearch".
  • effectiveUserName (optional) – String. Use when an end-user identity must be impersonated on the server. Specify the account in a domain\user format. Only for the "microsoft analysis services" data source type.
  • fieldSeparator (optional) – String. Defines the specific fields separator to split each CSV row. There is no need to define it if the CSV fields are separated by , or ;. This property is required only if another character separates fields.
    For example, if you use TSV, where a tab character is used to separate fields, then the fieldSeparator parameter should be set to "\t".
    Alternatively, you can specify the field separator in the CSV file’s first row using the sep prefix. Supported prefix formats are the following: sep=fieldSep and "sep=fieldSep". For example:
    Only for the "csv" data source type.
  • thousandsSeparator (optional) – String. Defines the specific character used to separate groups of digits in numbers. For example, if commas separate groups of digits in numbers (e.g., 1,000 for one thousand), set thousandsSeparator to ",". Only for the "csv" data source type.
  • filename (optional) – String. The URL to CSV or JSON file or a server-side script that generates CSV data or JSON data. Only for "csv" and "json" data source type.
  • ignoreQuotedLineBreaks (optional) – Boolean. Indicates whether the line breaks in quotes will be ignored (true) in CSV files or not (false). When set to true, CSV parsing is faster. Set it to false only if your data source has valuable for you line breaks in quotes. Please note that this might slow down CSV parsing a little bit. Default value: true.
  • localeIdentifier (optional) – Number. Microsoft Locale ID Value for your language. Only for the "microsoft analysis services" data source type.
  • proxyUrl (optional) – String. The path to proxy URL to Microsoft Analysis Services. Both tabular and multidimensional model types are supported. Only for the "microsoft analysis services" data source type.
  • url (optional) – String. The path to the API endpoints. Only for "api" data source type.
  • roles (optional) – String. Comma-delimited list of predefined roles to connect to a server or database using permissions conveyed by that role. If this property is omitted, all roles are used, and the effective permissions are the combination of all roles. Supported only for the "microsoft analysis services" data source type.
  • subquery (optional) – String | Object. The parameter to set the server-side filter, which helps decrease the size of the server’s response. Only for "microsoft analysis services" and "elasticsearch" data source types.
    For the "microsoft analysis services" data source type, the subquery should be set as a string. Example: to show reports only for one specific year, set subquery the following way: "subquery": "select {[Delivery Date].[Calendar].[Calendar Year].&[2008]} on columns from [Adventure Works]". See an example on JSFiddle.
    For the "elasticsearch" data source type, the subquery should be set as a BoolQueryObject. See an example on JSFiddle.
  • requestHeaders (optional) – Object. For all data sources. This object allows you to add custom request headers. This object consists of "key": "value" pairs, where "key" is a header name and "value" is its value. Check out a live sample on JSFiddle. Important note: requestHeaders is not saved when obtaining the report via save() and getReport() API calls.
  • singleEndpoint – Boolean. When set to true, all custom data source API requests are sent to a single endpoint specified in the url property. Only for the "api" data source type. Default value: false.
  • node (optional) – String. The URL string for the connection. Only for "elasticsearch" data source type.
  • index (optional) – String. The name of the Elasticsearch index to connect or the dataset identifier for the custom data source API. Only for "elasticsearch" and "api" data source types.
  • useStreamLoader (optional) – Boolean. Optimizes the large file processing using the stream loader. When set to true, the stream loader is enabled. Available only when loading JSON files via URL. See an example on JSFiddle. Default value: false.
  • withCredentials (optional) – Boolean. It indicates whether cross-site Access-Control requests should be made using credentials such as authorization headers (true) or not (false). For more details, refer to MDN web docs.
    Setting the withCredentials flag to true is recommended when using Windows authentication and other types of server authentications. When set to false, the browser does not request credentials and does not include them into outgoing requests. Default value: false.

The API calls connectTo(), updateData(), load(), and open() are used to change the data source at runtime. The API call save() is used to save the report.

See also

Data source guide