Page 1 of 1

Path to JSON Data editing via Code

Posted: Thu Feb 25, 2016 11:31 am
by Loki87
Hello,

is there a way after loading the report , to edit the Path to the JSON Data in the DataSource of the Report via code in js???
I know how to give the Path a Parameter in the designer and setting a value to a variable from code so the Data is loading correctly, but I need a way to set the Path in Code so it can take the parameter/variable

Path to JSON Data: http://stimulsoft.com/data/{Variable/Parameter I want to Set in Code}

Best regards

Loki

Re: Path to JSON Data editing via Code

Posted: Thu Feb 25, 2016 11:43 am
by HighAley
Hello, Loki.

You could use next code to change the path to JSON:

Code: Select all

report.dictionary.databases.getByIndex(0).pathData = "newPath";
Thank you.

Re: Path to JSON Data editing via Code

Posted: Thu Feb 25, 2016 1:49 pm
by Loki87
Hello HighAley,

thank you very much, it's working.

Re: Path to JSON Data editing via Code

Posted: Thu Feb 25, 2016 4:18 pm
by Loki87
Hello,

I have another question regarding the Path, how can I set the Path to JSON data via code if there isn't defined one before???

best regards

loki

Re: Path to JSON Data editing via Code

Posted: Fri Feb 26, 2016 7:56 am
by HighAley
Hello.

You could find sample code how to create a report with JavaScript code in the Stimulsoft KnowledgeBase.

Thank you.