Dear visitor, despite the COVID-19 outbreak, our team continues operating at full speed.

Also, here is the form where you can apply for a special discount and we will contact you with possible options. Stay safe and continue achieving your business goals.

Fill the form
Get Free Trial
Get Free Trial
  1. API reference
  2. Welcome
    1. Component overview
    2. Quick start
    3. System requirements
    4. Troubleshooting
    5. Managing license keys
    6. Migrating from WebDataRocks to Flexmonster
  3. Connecting to Data Source
    1. JSON
      1. Connecting to JSON
      2. Connecting to JSON using the custom data source API
      3. Data types in JSON
    2. CSV
      1. Connecting to CSV
      2. Connecting to CSV using the custom data source API
      3. Data types in CSV
    3. Database
      1. Connecting to SQL databases
      2. Connecting to a MySQL database
      3. Connecting to a Microsoft SQL Server database
      4. Connecting to a PostgreSQL database
      5. Connecting to an Oracle database
      6. Connecting to other databases
    4. MongoDB
      1. Introduction to the Flexmonster MongoDB Connector
      2. Getting started with the MongoDB Connector
      3. Embedding the MongoDB Connector into the server
    5. 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
    6. 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
    7. Elasticsearch
      1. Connecting to Elasticsearch
      2. Configuring the mapping
    8. Custom data source API
      1. Introduction to the custom data source API
      2. A quick overview of a sample Node.js server
      3. A quick overview of a sample .NET Core server
      4. Implementing the custom data source API server
      5. Implementing filters
      6. Returning data for the drill-through view
      7. Supporting more aggregation functions
  4. Security
    1. Security in Flexmonster
    2. Security aspects of connecting to an OLAP cube
      1. Ways of connecting to an OLAP cube
      2. The data transfer process
      3. Data security
      4. Data access management
  5. Configuring report
    1. What is a report
    2. Data source
    3. Slice
    4. Options
    5. Mapping
    6. Number formatting
    7. Conditional formatting
    8. Set the report for the component
    9. Get the report from the component
    10. Date and time formatting
    11. Configuring global options
    12. Export and print
    13. Calculated values
    14. 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 React Native
    6. Integration with Vue
    7. Integration with Python
      1. Integration with Django
      2. Integration with Jupyter Notebook
    8. Integration with R Shiny
    9. Integration with Webpack
    10. Integration with ASP.NET
    11. Integration with jQuery
    12. Integration with JSP
    13. Integration with TypeScript
    14. Integration with RequireJS
    15. 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 the Toolbar
    2. Customizing appearance
    3. Customizing the context menu
    4. Localizing the component
  9. Updating to the latest version
    1. Updating to the latest version
    2. Release notes
    3. Migration guide from 2.7 to 2.8
    4. Migration guide from 2.6 to 2.7
    5. Migration guide from 2.5 to 2.6
    6. Migration guide from 2.4 to 2.5
    7. Migration guide from 2.3 to 2.4
    8. Migration guide from 2.2 to 2.3
    9. 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.
  • type – 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]".
  • requestHeaders (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: requestHeaders is not saved when obtaining the report via save() and getReport() API calls.
  • withCredentials – Boolean. A flag to allow Windows authentification when connecting to Microsoft Analysis Services via both XMLA protocol and Flexmonster Accelerator. When set to false, Windows authentification is not allowed. Default value: false.

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

{
    dataSource: {
        type: "microsoft analysis services",
        proxyUrl: "http://olap.flexmonster.com/olap/msmdpump.dll", // URL to msmdpump.dll
        catalog: "Adventure Works DW Standard Edition",
        cube: "Adventure Works",
        localeIdentifier: 1036, // Microsoft Locale ID Value for French
        roles: "admin,manager", // roles from SSAS
        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: {
        type: "microsoft analysis services",
        proxyUrl: "http://localhost:50005",
        catalog: "Adventure Works DW Standard Edition",
        cube: "Adventure Works",
        binary: true,
        localeIdentifier: 1036, // Microsoft Locale ID Value for French
        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.
  • type – 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".
  • requestHeaders (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: requestHeaders 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: {
        type: "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: {
        type: "mondrian",
        proxyUrl: "localhost:50006",
        dataSourceInfo: "MondrianFoodMart",
        catalog: "FoodMart",
        cube: "Sales",
        binary: true,
        roles: "California manager" // Mondrian roles
    }
}

You can read all the details about the Accelerator here.

Elasticsearch

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

  • type – String. The type of the 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. This can be set to either a URL string ("node": "https://olap.flexmonster.com:9200") or an object with the following properties:
    • protocol – String. The node URL protocol.
    • host – String. The node URL hostname.
    • port – Number. The node URL port.
    • path (optional) – String. Thenode URL path.
  • index (optional) – String. The name of the Elasticsearch index to connect to.
  • requestHeaders (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: requestHeaders is not saved when obtaining the report via the save() and getReport() API calls.

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

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

Try the example on JSFiddle.

The custom data source API

Here is a list of dataSource properties used to connect to the custom data source API:

  • type – String. The type of data source. In this case, it is "api".
  • url – String. The path to the API endpoints.
  • index – String. The data set identifier.
  • requestHeaders (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: requestHeaders is not saved when obtaining the report via save() and getReport() API calls.

Here is an example of how a connection to the custom data source API is represented in a dataSource object:

{
dataSource: {
type: "api",
url: "http://localhost:3400/api/cube",
index: "fm-product-sales"
}
}

SQL databases

Here is a list of dataSource properties used to connect to SQL databases using the custom data source API:

  • type – String. The type of data source. In this case, it is "api".
  • url – String. The path to the API endpoints.
  • index – String. The data set identifier.
  • requestHeaders (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: requestHeaders is not saved when obtaining the report via save() and getReport() API calls.

Here is an example of how a connection to a relational database is represented in a dataSource object:

{
dataSource: {
type: "api",
url: "http://localhost:3400/api/cube",
index: "fm-product-sales"
}
}

Read more about connecting to SQL databases with the custom data source API here.

MongoDB databases

Here is a list of dataSource properties used to connect to a MongoDB database:

  • type – String. The type of data source. In this case, it is "api".
  • url – String. The path to the API endpoints.
  • index – String. The data set identifier.
  • requestHeaders (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: requestHeaders is not saved when obtaining the report via save() and getReport() API calls.

Here is an example of how a connection to a MongoDB database is represented in a dataSource object:

{
dataSource: {
type: "api",
url: "http://localhost:9204/mongo",
index: "fm-product-sales"
}
}

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.
  • type – 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 the 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). When set to true, CSV parsing is 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. Default value: true.
  • recordsetDelimiter – String. Defines which character is used in CSV to denote the end of a CSV row. Default value: "\n".
  • requestHeaders (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: requestHeaders 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, type must be defined explicitly:

{
    dataSource: {
        type: "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.
  • type – 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.
  • requestHeaders (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: requestHeaders 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, type must be defined explicitly:

{
    dataSource: {
        type: "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.