Example of rendering a report with Java and Json?

Stimulsoft Reports.JAVA discussion
Post Reply
mke_imp
Posts: 9
Joined: Tue Nov 29, 2016 9:15 am

Example of rendering a report with Java and Json?

Post by mke_imp »

I'm a bit lost on how to correctly initialize a report file with a json-datasource in java, and then getting it to render correctly.

I have a mrt-File and a json-File, those both work together fine, wenn looking at them in the designer.
But trying to do something like the following ends in a NullPointerException

Code: Select all

        
        StiReport report = StiSerializeManager.deserializeReport(new File("report/Selection.mrt"));
        StiJsonDatabase jsonDb = new StiJsonDatabase("Data", "report/data.json");
        StiDatabaseCollection coll = new StiDatabaseCollection();
        coll.add(jsonDb);
        report.dictionary.setDatabases(coll);
        report.setJsonReport(true);
        report.render();
Is there somewhere where I could find an example on how to render a report with a json-File through the Java-Libraries (2016.2)?

Thanks a lot in advance
mke_imp
Posts: 9
Joined: Tue Nov 29, 2016 9:15 am

Re: Example of rendering a report with Java and Json?

Post by mke_imp »

could solve the problem myself, the problem was in the way the json was built
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Example of rendering a report with Java and Json?

Post by Alex K. »

Hello

Ok.
Please let us know if you need any additional help.

Thank you.
mke_imp
Posts: 9
Joined: Tue Nov 29, 2016 9:15 am

Re: Example of rendering a report with Java and Json?

Post by mke_imp »

Unfortunately I really do have another problem ;) :

The json for the data now is built up as suggested in another thread with every object as an array, so that it can turned into a table. Now I have a groupheader, that takes its data from a table with relationships, but where I want to put as well some of the same data into for every grouped entry.

This once again seems to work fine in the designer (.NET 2016.2), but when rendering the report through java (see code in first post) I get a parse-error for a null-value.

I have some demo data attached, the problem lies within the PartialOffers.

I have already tried calling those values with PartialOffers.DataTable.Rows[0]["columnName"], but then the report does throw errors.
Attachments
auDemo.json
(15.29 KiB) Downloaded 381 times
AuDemo.mrt
(126.35 KiB) Downloaded 400 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Example of rendering a report with Java and Json?

Post by Alex K. »

Hello,

We need some additional time to check the issue.
We will let you know about the result in this topic.

Thank you.
Vadim
Posts: 362
Joined: Tue Apr 23, 2013 11:23 am

Re: Example of rendering a report with Java and Json?

Post by Vadim »

Hello.
The bug with PartialOffers will be fixed since 2016.3.1 pre-release build
mke_imp
Posts: 9
Joined: Tue Nov 29, 2016 9:15 am

Re: Example of rendering a report with Java and Json?

Post by mke_imp »

Thanks a lot for looking into it.
Do you have a timeframe when that pre-release build will be available?
Vadim
Posts: 362
Joined: Tue Apr 23, 2013 11:23 am

Re: Example of rendering a report with Java and Json?

Post by Vadim »

Hello.
Now you can use 2016.3 release.
mke_imp
Posts: 9
Joined: Tue Nov 29, 2016 9:15 am

Re: Example of rendering a report with Java and Json?

Post by mke_imp »

Thank you! Works great :-)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Example of rendering a report with Java and Json?

Post by HighAley »

Hello.

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

Thank you.
Post Reply