Page 1 of 1

Data Source issue with json database

Posted: Thu Dec 03, 2015 5:26 pm
by ogilvy
Hello,

I'm having issue with binding json data source

Changed just little bit your example code to have something like this:

Code: Select all

var report = new Stimulsoft.Report.StiReport(); 
var jsonDataBase = new Stimulsoft.Report.Dictionary.StiJsonDatabase("Demo", "demo.json");
report.dictionary.databases.add(jsonDataBase);
var designer = new Stimulsoft.Designer.StiDesigner(); 
designer.report = report;
And the issue I have is that on loaded designer, in "Data Sources", I see only "Demo [JSON]" without the whole structure (no tables & fields).
However, when I try to load the same json file within designer itself, it asks me which tables I want to import and then I can see all fields .

Is there something else that needs to be done while setting the database so that designer displays all tables and fields from the json file ?
(demo.json is the one found in Samples\JavaScript\reports folder)

Appreciate any help I can get :)
Thanks

Re: Data Source issue with json database

Posted: Fri Dec 04, 2015 1:11 am
by Ivan
Hello,

Please try to modify your code:

Code: Select all

var report = new Stimulsoft.Report.StiReport(); 
var dataSet = new Stimulsoft.System.Data.DataSet();
dataSet.readJsonFile("data/demo.json");
report.regData("Demo", "Demo", dataSet);
report.dictionary.synchronize();
var designer = new Stimulsoft.Designer.StiDesigner(); 
designer.report = report;
or

Code: Select all

var report = new Stimulsoft.Report.StiReport(); 
var jsonDataBase = new Stimulsoft.Report.Dictionary.StiJsonDatabase("Demo", "data/demo.json");
report.dictionary.databases.add(jsonDataBase);
report.dictionary.connect(false);
report.dictionary.synchronize();
var designer = new Stimulsoft.Designer.StiDesigner(); 
designer.report = report;
Thank you.

Re: Data Source issue with json database

Posted: Fri Dec 04, 2015 8:52 am
by ogilvy
Thank you very much for your quick reply

Addition of following lines solved the issue:

Code: Select all

report.dictionary.connect(false);
report.dictionary.synchronize();

Re: Data Source issue with json database

Posted: Fri Dec 04, 2015 11:14 am
by HighAley
Hello.

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

Thank you.