JSON datasource error with StiJsonToDataSetConverter command

Stimulsoft Reports.NET discussion
Post Reply
info@lts.it
Posts: 7
Joined: Tue Jan 08, 2019 1:57 pm

JSON datasource error with StiJsonToDataSetConverter command

Post by info@lts.it »

Hello,

I use Reports.Net products to develop reports and Reports.web to publish them on the internet (version 2019.1.1).

When I import the attached json into the designer everything works and the data is rendered correctly (screenshot_designer.png).
However, when I use the StiJsonToDataSetConverter command to synchronize the dataset via code, the report
does not recognize the json and displays nothing, the report is empty, even if the json file is the same, the “test.json” file.
I use these commands:

Report.Dictionary.Databases.Clear();
var Dset = StiJsonToDataSetConverter.GetDataSetFromFile(@ "E:\_SPRINT\LTSE-722\test.json");
Report.RegData ("ds", Dset);
Report.Dictionary.Synchronize();

The very strange thing is that if I remove the "Report" element in the json then the dataset is managed
successfully and the report synchronizes. I wonder why the designer is able to manage this structure
while the code not.

Thanks and best regards,
Ivan.
Attachments
test.json
(222 Bytes) Downloaded 125 times
screenshot_designer.PNG
screenshot_designer.PNG (17.45 KiB) Viewed 2972 times
ReportTest.mrt
(6.28 KiB) Downloaded 124 times
info@lts.it
Posts: 7
Joined: Tue Jan 08, 2019 1:57 pm

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by info@lts.it »

Hello,

I also tried with the latest version 2021.2.3 but the problem persists, please let me know what I'm doing wrong.

Thanks a lot and best regards,
Ivan.
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by Lech Kulikowski »

Hello,

Please try to use the StiJsonToDataSetConverterV2.

Thank you.
info@lts.it
Posts: 7
Joined: Tue Jan 08, 2019 1:57 pm

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by info@lts.it »

Hello Lech,

yes now it works, I see the data in the report.
But with parent-child relationships it doesn't work!

Please look at the file I sent you with an example of complex json!
in the designer everything is fine, as soon as I use the StiJsonToDataSetConverterV2 the elements of the relations are not shown.

Many thanks,
Ivan.
Attachments
ReportTest.mrt
(10.83 KiB) Downloaded 132 times
test.json
(470 Bytes) Downloaded 127 times
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by Lech Kulikowski »

Hello,

The issue with relations names. In your original report, its were added manually and has different names if use the Synchronize method.
Please correct that.

Also, should be:
report.RegData("test", Dset);

Thank you.
Attachments
Screenshot 2021-04-19 163021.png
Screenshot 2021-04-19 163021.png (114.2 KiB) Viewed 2910 times
ReportTest.mrt
(11.7 KiB) Downloaded 129 times
info@lts.it
Posts: 7
Joined: Tue Jan 08, 2019 1:57 pm

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by info@lts.it »

Hi Lech,

many thanks, it worked perfectly !!!

But I still have two questions:
1) in my json example I have the seller element which does not have a parent-child relationship to the cart element, but, let's say, is his brother. How do I need to name the relationship to see the CompanyName attribute?
2) I develop the report in the designer, I have not seen the syncronize command, so I have to create all the relations and their names manually. is there a funyionality in the web.designer that I have not seen?

Many thanks and best regards,
Ivan.
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by Lech Kulikowski »

Hello,

1) if in Seller only one record, you can use {Seller.CompanyName}. If several, you should add a relation.

2) In the Action menu.

Thank you.
Attachments
Screenshot 2021-04-19 235310.png
Screenshot 2021-04-19 235310.png (53.32 KiB) Viewed 2906 times
info@lts.it
Posts: 7
Joined: Tue Jan 08, 2019 1:57 pm

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by info@lts.it »

Hello,

perfect, everything works!

thank you very much

Best Regards,
Ivan.
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: JSON datasource error with StiJsonToDataSetConverter command

Post by Lech Kulikowski »

Hello Ivan,

You are welcome!
Post Reply