Empty data set

Stimulsoft Reports.JS discussion
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Empty data set

Post by Ehsan »

Hello

I use Below codes to build create data set from json like this: {agendaDataSource: [], tasksDataSource: []},
and there is a relation between them.

consider I have two data source,

If those be empty, I can not use them on my codes,

Actually I have a relation between two data source, If one of these data sources be empty, stimulsoft generate an error like this:

Column 'Id' does not exist in Data Source 'agendaDataSource' and relation 'MyRelation1' can't be created!
4.PNG
4.PNG (5.22 KiB) Viewed 6388 times

Code: Select all

var stiDataSet = new Stimulsoft.System.Data.DataSet(webComponent.context["name"] + "DataSetObject");
stiDataSet.readJson(data);
report.regData(stiDataSet.dataSetName, "", stiDataSet);

var trueFileName = "scripts/app/report/" + webComponent.fileName + ".mrt";
report.loadFile(trueFileName);
Thanks
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Empty data set

Post by Edward »

Hi Ehsan,

Please make sure that the report template has got the required DataSet with the correct relations already registered in the report's Dictionary. And then, when you register an empty JSON, the report should work just fine, because the Dictionary will know about the 'MyRelation1' relation between the individual tables agendaDataSource, tasksDataSource.

Please attach a sample project if the problem is still there after following these steps as per above comment.

Thank you,
Edward
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Empty data set

Post by Ehsan »

Hello dear Edward,

Please Take a look at below sample:

Code: Select all

var stiDataSet1 = new Stimulsoft.System.Data.DataSet("DataSet1Object");
stiDataSet1.readJson({agendaDataSource: [], tasksDataSource: []});
report.regData(stiDataSet1.dataSetName, "", stiDataSet1);
So
stiDataSet1.tables.list is empty!!!!

Actually there is a table with empty data, but above codes can not build it!!

So some codes like this can not work:

Code: Select all

var reportEquipmentsDataSource = new Stimulsoft.Report.Dictionary.StiDataTableSource();
reportEquipmentsDataSource.name = "agendaDataSource";
reportEquipmentsDataSource.alias = "agendaDataSource";
reportEquipmentsDataSource.nameInSource = "repairRequestDetailsReportDataSetObject.agendaDataSource";
Thanks.
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Empty data set

Post by Ehsan »

Please take a look at attached report

Tanks
Attachments
Demo.rar
(2.7 MiB) Downloaded 202 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Empty data set

Post by Edward »

Hi Ehsan,

Thank you for the provided example. It did not render any data, you are correct. Could you please try to load the report template from the file first, as you did it:

Code: Select all

report.loadFile(trueFileName);
And only after that register the data without the following code:

Code: Select all

report.regData("meetingPrintDataSetObject", "meetingPrintDataSetObject", stiDataSet);
In that case even if the dataset contains empty tables, the Dictionary should know about the required relations (MyRelation1).

Thank you,
Edward
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Empty data set

Post by Ehsan »

Hello Edward,

I use below codes, but I have still the same issue:

Code: Select all

var trueFileName = "reports/SimpleList.mrt";
report.loadFile(trueFileName);
var dataObject = JSON.parse(JSON.stringify(Demo));
report.regData("meetingPrintDataSetObject", "meetingPrintDataSetObject", dataObject);
Thanks
Attachments
Demo.rar
(2.7 MiB) Downloaded 198 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Empty data set

Post by Edward »

Hi Ehsan,

The report did not return any data indeed, but the error about the relations that you mentioned is not happening anymore as well. I have checked the solution you kindly attached.

Please also try removing the following line:

Code: Select all

report.dictionary.databases.clear();
Thank you,
Edward
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Empty data set

Post by Ehsan »

Hello dears,

Can you please test it your self?
I Already remove below code from project, but I have same issue yet.

Code: Select all

report.dictionary.databases.clear();
Please look at attached report.

Thanks
Attachments
Demo.rar
(2.7 MiB) Downloaded 227 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Empty data set

Post by Edward »

Hi Ehsan,

Thank you for the sample project, really helpful. We are reviewing it and will reply to you shortly.

Thank you,
Edward
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Empty data set

Post by Ehsan »

Hello,

Is there any good news?
Post Reply