Page 1 of 2
Empty data set
Posted: Sun Aug 27, 2017 4:12 am
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 (5.22 KiB) Viewed 7263 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
Re: Empty data set
Posted: Mon Aug 28, 2017 2:16 am
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
Re: Empty data set
Posted: Mon Aug 28, 2017 7:22 am
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.
Re: Empty data set
Posted: Mon Aug 28, 2017 10:28 am
by Ehsan
Please take a look at attached report
Tanks
Re: Empty data set
Posted: Tue Aug 29, 2017 4:00 am
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:
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
Re: Empty data set
Posted: Tue Aug 29, 2017 9:43 am
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
Re: Empty data set
Posted: Thu Aug 31, 2017 2:28 am
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
Re: Empty data set
Posted: Sun Sep 17, 2017 9:01 am
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
Re: Empty data set
Posted: Mon Sep 18, 2017 4:28 am
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
Re: Empty data set
Posted: Sun Nov 05, 2017 12:32 pm
by Ehsan
Hello,
Is there any good news?