Menu
Download Free Trial
Table of contents

connectTo

connectTo(params:Object)

[starting from version: 1.4]

This method is used for connection to the data source without cleaning the report. Please note, starting from version 2.3 there is a new API call updateData to update data for the report.

Possible data sources:

  • OLAP cube via XMLA protocol (Microsoft Analysis Services, Mondrian, icCube)
  • OLAP cube via our proxy (Microsoft Analysis Services, Mondrian)
  • CSV (static file or data generated by server-side script)
  • CSV file from the local file system
  • JSON (starting from v2.2) – see addJSON() for more details and samples

Parameters

params – the object which contains connection parameters. List of possible parameters:

  • dataSourceType – type of data source. The component supports the following types: "microsoft analysis services", "mondrian", "iccube", "csv", "ocsv", "json".
  • proxyUrl – the path to proxy URL to the OLAP data source, such as Microsoft Analysis Services, Mondrian, icCube (only for "microsoft analysis services", "mondrian", "iccube" data source types)
  • dataSourceInfo – the service info of the OLAP data source (only for "microsoft analysis services", "mondrian", "iccube" data source types)
  • catalog – the data source catalog name of the OLAP data source (only for "microsoft analysis services", "mondrian", "iccube" data source types)
  • cube – given catalog’s cube’s name of the OLAP data source (only for "microsoft analysis services", "mondrian", "iccube" data source types)
  • filename – the URL to CSV file or to server-side script which generates CSV data (only for "csv", "ocsv" and "json" data source type)
  • browseForFile – this boolean parameter defines whether you want to load CSV file from the local file system (true) or not (false). It is false by default. (only for "csv", "ocsv" and "json" data source type)
  • fieldSeparator – defines specific fields separator to split CSV row (only for "csv" data source type). There is no need to define it if CSV fields are separated by , or ;. This property is used if another char separates fields. For example, if you use TSV, where tab char is used to separate fields in row, fieldSeparator parameter should be defined explicitly.

Examples

1) This example on JSFiddle demonstrates the connection to the following data sources: Microsoft Analysis Services, Mondrian, icCube, CSV, and JSON.

2) Connect to Microsoft Analysis Services:

flexmonster.connectTo({
  dataSourceType: 'microsoft analysis services',
  proxyUrl: 'http://olap.flexmonster.com/olap/msmdpump.dll',
  dataSourceInfo: 'Provider=MSOLAP; Data Source=extranet;', 
  catalog: 'Adventure Works DW Standard Edition', 
  cube: 'Adventure Works'
});

3) Connect to Mondrian:

flexmonster.connectTo({
  dataSourceType: 'mondrian', 
  proxyUrl: 'http://olap.flexmonster.com:8080/mondrian/xmla', 
  dataSourceInfo: 'MondrianFoodMart', 
  catalog: 'FoodMart', 
  cube: 'Sales'
});

4) Connect to icCube:

flexmonster.connectTo({
  dataSourceType: 'iccube', 
  proxyUrl: 'http://olap.flexmonster.com:8282/icCube/xmla', 
  dataSourceInfo: 'icCube-datasource', 
  catalog: 'Sales', 
  cube: 'Sales' 
});

5) Connect to CSV data source:

flexmonster.connectTo({
  dataSourceType: 'csv', 
  filename: 'data/csv/arabic.csv'
});

6) Connect to CSV file where colon char is used to separate fields in the row. You have to define fieldSeparator explicitly:

flexmonster.connectTo({
  dataSourceType: 'csv',
  filename: 'colon-data.csv',
  fieldSeparator: ':'
});

7) Open local CSV file:

flexmonster.connectTo({
  dataSourceType: 'csv', 
  browseForFile: true
});

See also

updateData
open
load
save
getReport
setReport