Page 1 of 1

JSON datasource error with StiJsonToDataSetConverter command

Posted: Tue Apr 13, 2021 3:15 pm
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.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Wed Apr 14, 2021 12:20 pm
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.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Wed Apr 14, 2021 9:40 pm
by Lech Kulikowski
Hello,

Please try to use the StiJsonToDataSetConverterV2.

Thank you.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Mon Apr 19, 2021 9:39 am
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.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Mon Apr 19, 2021 2:35 pm
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.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Mon Apr 19, 2021 3:36 pm
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.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Mon Apr 19, 2021 9:55 pm
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.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Tue Apr 20, 2021 2:17 pm
by info@lts.it
Hello,

perfect, everything works!

thank you very much

Best Regards,
Ivan.

Re: JSON datasource error with StiJsonToDataSetConverter command

Posted: Tue Apr 20, 2021 9:51 pm
by Lech Kulikowski
Hello Ivan,

You are welcome!