Get Free Trial
API reference
Table of contents

DataSourceObject

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 optionalMappingObject | 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 an inline MappingObject or a 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.
  • dataRootPath optional — String. Specifies a path to a nested JSON property that contains data for Flexmonster. See supported JSON formats.
    The dataRootPath works only for files loaded via the filename property. The files must not be larger than 30 MB.
    Example: set the dataRootPath to "userData.flexmonsterData" to connect to the following JSON file:
    {
    "creationDate": "01-01-2022",
    "userData" : {
    "flexmonsterData": [
    // your data
    ],
    },
    }
    See the full code on JSFiddle.
    This property is not compatible with useStreamLoader.
    Only for the "json" data source type.
  • 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:
    sep=|
    Country|Color|Price
    Canada|blue|1000
    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 a JSON/CSV file or a server-side script that generates JSON/CSV data.
    For JSON files, if your data is located in a nested property, specify a path to that property in the dataRootPath.
    Only for "csv" and "json" data source types.
  • 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 the "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 the "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.
  • useGranularityNamesForDateFilters optional — Boolean. Allows adjusting date filters to the cube structure.
    If set to true, date filters use granularityNames. If set to false, date filters use the unique name of the hierarchy being filtered.
    Only for the "microsoft analysis services" data source type. Default value: true.
  • useStreamLoader optional – Boolean. Optimizes processing of large .json files using the stream loader. When set to true, the stream loader is enabled. See an example on JSFiddle.
    useStreamLoader works only when loading JSON files via URL. Not compatible with the dataRootPath property.
    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 ask for credentials and does not include them in outgoing requests. Default value: false.
  • concurrentRequests optional – Boolean. When set to false, Flexmonster sends a request for each expand/drill-down separately and waits for the server’s response before sending a new request. This can result in slow performance when there are a lot of expands/drill-downs in the report. When the concurrentRequests is true, Flexmonster sends requests for expands/drill-downs of a particular level simultaneously. To get the best performance, enable the HTTP/2 protocol on your server. Only for the "api" data source type. 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
connectTo()
updateData()
load()
open()
save()