Page 1 of 1

Using Json as Datasource

Posted: Thu Oct 08, 2015 11:36 am
by ProIT
Hi there

I have a json file as a datasource for a report. Unfortunately I am not able to load the report with the json datasource (don't know where to start). Is there a sample of how to create a report with a json datasource (and change the path to the json-file at runtime)? Or do I need to load the json file into an dataset / list?

Thank you for your support!
Mike

Re: Using Json as Datasource

Posted: Thu Oct 08, 2015 1:43 pm
by HighAley
Hello.

You could use the StiJsonToDataSetConverter class to load JSON from file and register the DataSet that you get.

Code: Select all

var ds = StiJsonToDataSetConverter.GetDataSetFromFile(@"d:\server.en.json");
report.RegData(ds);
If you need to change path to the JSON file you could use next code:

Code: Select all

(report.Dictionary.Databases[0] as StiJsonDatabase).PathData = yourPath;
Thank you.

Re: Using Json as Datasource

Posted: Thu Oct 08, 2015 2:19 pm
by ProIT
Hi

Works perfectly!

Thank you very much!
Mike

Re: Using Json as Datasource

Posted: Fri Oct 09, 2015 5:16 am
by HighAley
Hello, Mike.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.