Data Source issue with json database

Stimulsoft Reports.JS discussion
Post Reply
ogilvy
Posts: 2
Joined: Thu Dec 03, 2015 5:12 pm

Data Source issue with json database

Post 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
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Data Source issue with json database

Post 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.
ogilvy
Posts: 2
Joined: Thu Dec 03, 2015 5:12 pm

Re: Data Source issue with json database

Post 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();
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Data Source issue with json database

Post by HighAley »

Hello.

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

Thank you.
Post Reply