Can we directly pass configuration as string without creating a file stream?


Config.xml , where we can prepare the layout structure, creation of measures, datasource type and filename where the source data exists..etc..
it may different for different users. How do we create this manually or any functions avaialble for auto-generation?
Can we directly pass configuration as string(xml string) without creating a file stream?

4 answers

Ian Sadovy Staff November 26, 2015

Hello Sunil,
Thank you for the request.
Please refer to the following API functions:
getReport(format:String):* – Returns an object or XML string which describes the current report. Use this object to save or edit report at runtime.
format (optional) – format in which report will be returned (starting from v1.901). Can be “xmlstring” or “object”. Default is “object”.
setReport(report:*) – Sets a report to be displayed in the component. Use this method to load and show previously saved reports.
report – the object or XML string (starting from v1.901) which describes the report and contains all its properties.
These functions will help you to get, update and set configuration in desired format.
More documentation is available here:

kumar November 27, 2015

Hi Ian,
Thanks for your response.
I was trying to load csv file from local disk, but throwing an error. please look into below code and error details:
flexmonster.connectTo({ filename: “C:\\FlexMonster\\data.csv”, dataSourceType: “csv” });
Unable to open file C:\FlexMonster\data.csv?402394939.

It seems that this file doesn’t exist or ‘Access-Control-Allow-Origin’ header is absent in the resource requested.
Can you please suggest me on this issue?

Ian Sadovy Staff November 27, 2015

Hi Sunil,
Please note that the filename should be a relative path to the componentFolder (that is specified in the embedPivotComponent() function).
It’s not possible to use absolute path to local files due to JavaScript restrictions.
Also, do you open your html file in browser right away from the folder on your local computer?
If yes, the problem with opening data.csv file may be caused by browser’s security policy as well. It doesn’t allow the component to access to the local file.
There are two ways here:
1. Open demo with Firefox. It doesn’t have such strict security rules.
2. Put this demo on the web server like http://localhost.

Please let me know if the above works for you.

kumar November 27, 2015

Thanks Ian. absolute path is working for me.

Please login or Register to Submit Answer