1. API reference
  2. Welcome
    1. Component overview
    2. Quick start
    3. System requirements
    4. Troubleshooting
    5. Managing license keys
  3. Connecting to Data Source
    1. JSON
      1. Connecting to JSON
      2. Connecting to JSON using the Data Compressor
      3. Data types in JSON
    2. CSV
      1. Connecting to CSV
      2. Connecting to CSV using the Data Compressor
      3. Data types in CSV
    3. Database
      1. Connecting to SQL databases
      2. Connecting to other databases
      3. Connecting to a database with Node.js
      4. Connecting to a database with .NET
      5. Connecting to a database with .NET Core
      6. Connecting to a database with Java
      7. Connecting to a database with PHP
    4. Microsoft Analysis Services
      1. Connecting to Microsoft Analysis Services
      2. Getting started with the Accelerator
      3. Installing the Accelerator as a Windows service
      4. Referring the Accelerator as a DLL
      5. Configuring the authentication process
      6. Configuring a secure HTTPS connection
      7. Troubleshooting
    5. Pentaho Mondrian
      1. Connecting to Pentaho Mondrian
      2. Getting started with the Accelerator
      3. Configuring Mondrian roles
      4. Configuring username/password protection
      5. Configuring a secure HTTPS connection
      6. Troubleshooting
    6. Elasticsearch
      1. Connecting to Elasticsearch
      2. Configuring the mapping
  4. Security
    1. Security in Flexmonster
    2. Security aspects when connecting to an OLAP cube
      1. The data transfer process
      2. Data security
      3. Data access management
    3. Security aspects when connecting to a database
      1. The data transfer process
      2. Data access management
  5. Configuring report
    1. What is a report
    2. Data source
    3. Slice
    4. Options
    5. Number formatting
    6. Conditional formatting
    7. Set the report for the component
    8. Get the report from the component
    9. Date and time formatting
    10. Configuring global options
    11. Export and print
    12. Calculated values
    13. Custom sorting
  6. Integration with frameworks
    1. Available tutorials
    2. Integration with AngularJS (v1.x)
    3. Integration with Angular
    4. Integration with React
    5. Integration with Webpack
    6. Integration with ASP.NET
    7. Integration with jQuery
    8. Integration with JSP
    9. Integration with TypeScript
    10. Integration with RequireJS
    11. Integration with PhoneGap
  7. Integration with charts
    1. Integration with Highcharts
    2. Integration with Google Charts
    3. Integration with FusionCharts
    4. Integration with any charting library
  8. Customizing
    1. Customizing toolbar
    2. Customizing appearance
    3. Customizing context menu
    4. Localizing component
  9. Updating to the latest version
    1. Updating to the latest version
    2. Release notes
    3. Migration guide from 2.6 to 2.7
    4. Migration guide from 2.5 to 2.6
    5. Migration guide from 2.4 to 2.5
    6. Migration guide from 2.3 to 2.4
    7. Migration guide from 2.2 to 2.3
    8. Documentation for older versions
Table of contents

Data source

The data source is a required part of the report object. Flexmonster supports data from OLAP data sources, SQL databases, CSV and JSON static files, and inline JSON data. Each data source requires specific properties to be set inside the dataSource section of the report object. Read more in the following sections:

Data from OLAP data sources

OLAP data sources include Microsoft Analysis Services and Mondrian. There are two ways to connect to an OLAP cube using Flexmonster Pivot:

  1. via the XMLA protocol – an industry standard for data access in analytical systems
  2. via Flexmonster Accelerator – a special server-side utility developed by Flexmonster

Microsoft Analysis Services

Here is a list of dataSource properties used to connect to Microsoft Analysis Services:

  • catalog – String. The data source catalog name.
  • cube – String. The given catalog’s cube’s name.
  • dataSourceInfo (optional) – String. The service info.
  • dataSourceType – String. The type of data source. In this case it is "microsoft analysis services".
  • proxyUrl – String. The path to the proxy URL. Both tabular and multidimensional model types are supported.
  • binary (optional) – Boolean. A flag to use Flexmonster Accelerator instead of the XMLA protocol.
  • effectiveUserName (optional) – String. Use when an end user identity must be impersonated on the server. Specify the account in a domain\user format.
  • localeIdentifier (optional) – Number. The Microsoft locale ID value for your language.
  • roles (optional) – String. A comma-delimited list of predefined roles to connect to a server or a database using the permissions defined by that role. If this property is omitted, all roles are used and the effective permissions are the combination of all roles. For example, to combine "admin" and "manager" roles, set the roles property like so: roles: "admin,manager".
  • subquery (optional) – String. The parameter to set a server-side filter to decrease the size of the response from the OLAP cube. For example, to show reports for only one specific year, set the subquery like so: "subquery": "select {[Delivery Date].[Calendar].[Calendar Year].&[2008]} on columns from [Adventure Works]".
  • requestHeader (optional) – Object. 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: requestHeader is not saved when obtaining the report via save() and getReport() API calls.

Here is an example of how the connection to SSAS via XMLA is represented in dataSource:

{
    dataSource: {
        dataSourceType: "microsoft analysis services",
		// URL to msmdpump.dll 
        proxyUrl: "http://olap.flexmonster.com/olap/msmdpump.dll",
        catalog: "Adventure Works DW Standard Edition",
        cube: "Adventure Works",
        // Microsoft Locale ID Value for French
        localeIdentifier: 1036,
        // roles from SSAS
        roles: "admin,manager",
        subquery: "select 
            {[Delivery Date].[Calendar].[Calendar Year].&[2008]} 
            on columns from [Adventure Works]"
    }
}

Check it out on JSFiddle.

Here is an example of how the connection to SSAS via Flexmonster Accelerator is represented in dataSource:

{
    dataSource: {
        dataSourceType: "microsoft analysis services",
        proxyUrl: "http://localhost:50005",
        catalog: "Adventure Works DW Standard Edition",
        cube: "Adventure Works",
        binary: true,
        // Microsoft Locale ID Value for French
        localeIdentifier: 1036,
        subquery: "select 
            {[Delivery Date].[Calendar].[Calendar Year].&[2008]} 
            on columns from [Adventure Works]"
    }
}

You can read all the details about the Accelerator here.

Mondrian

Here is a list of dataSource properties used to connect to Mondrian:

  • catalog – String. The data source catalog name.
  • cube – String. The given catalog’s cube’s name.
  • dataSourceInfo – String. The service info.
  • dataSourceType – String. The type of data source. In this case it is "mondrian".
  • proxyUrl – String. The path to the proxy URL.
  • binary (optional) – Boolean. A flag to use Flexmonster Accelerator instead of the XMLA protocol.
  • roles (optional) – String. A comma-delimited list of predefined roles to connect to a server or a database using the permissions defined by that role. If this property is omitted, all roles are used and the effective permissions are the combination of all roles. For example, to combine "admin" and "manager" roles, set the roles property like so: roles: "admin,manager".
  • requestHeader (optional) – Object. 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: requestHeader is not saved when obtaining the report via save() and getReport() API calls.

Here is an example of how the connection to Mondrian via XMLA is represented in dataSource:

{
    dataSource: {
        dataSourceType: "mondrian",
		// URL to the XMLA provider 
        proxyUrl: "http://olap.flexmonster.com:8080/mondrian/xmla",
        dataSourceInfo: "MondrianFoodMart",
        catalog: "FoodMart",
        cube: "Sales"
    }
}

Try the example on JSFiddle.

Here is an example of how the connection to Mondrian via Flexmonster Accelerator is represented in dataSource:

{
    dataSource: {
        dataSourceType: "mondrian",
        proxyUrl: "localhost:50006",
        dataSourceInfo: "MondrianFoodMart",
        catalog: "FoodMart",
        cube: "Sales",
        binary: true,
        // Mondrian roles
        roles: "California manager"
    }
}

You can read all the details about the Accelerator here.

Elasticsearch

Here is a list of dataSource properties used to connect to Elasticsearch:

  • dataSourceType – String. The type of data source. In this case it is "elasticsearch".
  • subquery (optional) – Bool Query Object. The parameter to set a server-side filter to decrease the size of the response from the server.
  • node (optional) – String|Object. The host for the connection. Can be set either as a URL string ("node": "https://olap.flexmonster.com:9200") or as an object with the following properties:
    • protocol – String. node URL protocol.
    • host – String. node URL hostname.
    • port – Number. node URL port.
    • path (optional) – String. node URL path.
  • index (optional) – String. The name of Elasticsearch index to connect.
  • requestHeader (optional) – Object. 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: requestHeader is not saved when obtaining the report via save() and getReport() API calls.
  • mapping (optional) – Object. An additional setting to configure index mapping. Use the name of the field as a key of the object with the following parameters:
    • caption (optional) – String. Overrides the default name of the field.
    • visible (optional) – Boolean. When set as false, hides the field from the Field List.
    • interval (optional) – String. Used for date histogram. Check out supported time units.
    • time_zone (optional) – String. Used for date histogram. You can specify timezones as either an ISO 8601 UTC offset (e.g. +01:00 or -08:00) or as a timezone ID as specified in the IANA timezone database, such as`America/Los_Angeles`. Check out the example.
    • format (optional) – String. Used for date histogram. Check out date format/pattern.
    • min_doc_count (optional) – Number. Used for date histogram. Can be used to show intervals with empty values (min_doc_count: 0). Default value: 1 (empty intervals are hidden).

Here is an example of how the connection to Elasticsearch is represented in dataSource:

{
    dataSource: {
        dataSourceType: "elasticsearch",
        node: "https://olap.flexmonster.com:9200",
        index: "fm-product-sales"
    }
}

Try the example on JSFiddle.

SQL databases

Here is a list of dataSource properties used to connect to SQL databases using the Data Compressor:

  • dataSourceType – String. The type of data source. In this case it is "ocsv".
  • filename – String. The URL to the server-side script which generates data.
  • requestHeader (optional) – Object. 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: requestHeader is not saved when obtaining the report via save() and getReport() API calls.

Flexmonster Data Compressor returns data in OCSV (Optimized CSV) format so you need to define dataSourceType explicitly:

{
    dataSource: {
        dataSourceType: "ocsv",
        /* URL to the Data Compressor Node.js, .Net, Java, or PHP */
        filename: "http://localhost:55772/api/flexmonster/get"
    }
}

Read more about the Data Compressor here.

CSV data sources

CSV data source can be:

  • A file from the local file system
  • A remote static file
  • Data generated by a server-side script

Here is a list of dataSource properties used to connect to CSV data sources:

  • browseForFile – Boolean. Defines whether you want to load a file from the local file system (true) or not (false). Default value: false.
  • dataSourceType – String. The type of data source. In this case it is "csv". You do not need to explicitly define this property when reading static CSV files with a “.csv” extension.
  • fieldSeparator – 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".
  • thousandSeparator (optional) – String. Defines specific character used to separate groups of digits in numbers. For example, to import CSV data with commas used to separate groups of digits in numbers (e.g. 1,000 for one thousand), set thousandSeparator parameter as ",".
  • filename – String. The URL to the file or to the server-side script which generates data.
  • ignoreQuotedLineBreaks (from v2.1) – Boolean. Indicates whether line breaks in quotes should be ignored (true) or not (false). Default value: true – this makes CSV parsing faster. Set it to false only if your data source has important line breaks in quotes. Note that this might slow down CSV parsing a little bit.
  • recordsetDelimiter – String. Defines which character is used in CSV to denote the end of a CSV row. Default value: "\n".
  • requestHeader (optional) – Object. 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: requestHeader is not saved when obtaining the report via save() and getReport() API calls.

In the following example data is taken from a CSV file where the colon character (:) is used to separate fields within the row. Line breaks in quotes are not ignored:

{
    dataSource: {
        /* URL or local path to a CSV file */
        filename: 'colon-data.csv',
        fieldSeparator: ':',
        ignoreQuotedLineBreaks: false
    }
}

If the data is generated by a server-side script, dataSourceType must be defined explicitly:

{
    dataSource: {
        dataSourceType: "csv",
        filename: "script_which_returns_csv_data"
    }
}

JSON data sources

JSON data source can be:

  • Files from the local file system
  • A remote static file
  • Data generated by a server-side script
  • Inline JSON

Here is a list of dataSource properties used to connect to JSON data sources:

  • browseForFile – Boolean. Defines whether you want to load the file from the local file system (true) or not (false). Default value: false.
  • data (from v2.2) – JSON. The inline JSON data.
  • dataSourceType – String. The type of data source. In this case it is "json". You do not need to explicitly define this property when reading static JSON files with a “.json” extension.
  • filename – String. The URL to the file or to the server-side script which generates data.
  • requestHeader (optional) – Object. This object allows you to add custom request headers. The 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: requestHeader is not saved when obtaining the report via save() and getReport() API calls.

Here is an example of JSON data set using a file from the local file system:

{
    dataSource: {
        /* Path to the local JSON file */
        filename: "data.json"
    }
}

If the data is generated by a server-side script, dataSourceType must be defined explicitly:

{
    dataSource: {
        dataSourceType: "json",
        filename: "script_which_returns_json_data"
    }
}

Inline JSON:

{
    dataSource: {
        /* jsonData variable contains JSON data */
        data: jsonData
    }
}

Change the data source using the Toolbar

Use the Connect option to choose another data source or Open to load another report at runtime. Use Save to save the report with the current data source.

dataSource

Data in the pivot table will be updated and saved within the report.

Data source via API

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