Get Free Trial
API reference
Table of contents

connectTo

connectTo(dataSource: DataSourceObject)

[starting from version: 1.4]

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

Parameters

The DataSourceObject which contains connection parameters.

Examples

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

2) Connect to Microsoft Analysis Services:

flexmonster.connectTo({
  type: '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 Elasticsearch:

flexmonster.connectTo({
 type: 'elasticsearch',
node: 'https://olap.flexmonster.com:9200',
index: 'fm-product-sales'
});

4) Connect to CSV data source:

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

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

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

6) Open local CSV file:

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

See also

updateData
open
load
save
getReport
setReport