json data source binding

Stimulsoft Reports.JAVA discussion
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

json data source binding

Post by heqichao »

hello stimulsoft
I use stimulsoft reports java on my project,and I want to use json data as data source , but I dont know how to bind the data on the GUI such as the json is : {
"weatherinfo": {
"city": "beijing",
"cityid": "101010100",
"temp": "18",
"WS": "one",
"SD": "17%",
"WSE": "1",
"time": "17:05",
"isRadar": "1",
"Radar": "JC_RADAR_AZ9010_JB",
"qy": "1011",
"rain": "0"
}
}

I dont understand how to use it on the text expression .
Looking forward to your reply,thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: json data source binding

Post by HighAley »

Hello.

Sorry, for delay with answer.
We need additional time to prepare it.

Thank you.
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: json data source binding

Post by heqichao »

Thanks for your response/reply,I am looking forward to the json data demo ,and I have other questions:
1、How to export the pdf file on java code
2、On the Chinese Disorder Code preview as pdf
thank you.
Vadim
Posts: 409
Joined: Tue Apr 23, 2013 11:23 am

Re: json data source binding

Post by Vadim »

Hello.
To use JSON datasource you can do next way:
1. Add new connection
2. Select JSON Data
3. On filed "Path to JSON Data" you can write JSON-file path or url to JSON data.
1.png
1.png (30.56 KiB) Viewed 7585 times
For export PDF (and in Chinese) you can use next code:

Code: Select all

StiExportManager.exportPdf(StiReport, StiPdfExportSettings, OutputStream);
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: json data source binding

Post by heqichao »

Hello, thanks for you reply.
I have set the json data source (http://img.hoop8.com/attachments/1603/2053528282908.png)
, and the json is {"aaa":{"s1":"s1","s2":"s2"}}, but in the TEXT, how to binding the json s2 ? {aaa.s2} is not work.
thank
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: json data source binding

Post by heqichao »

Hello, thanks for you reply.
I have set the json data source
Image
(http://img.hoop8.com/attachments/1603/6443528282908.png)
, and the json is {"aaa":{"s1":"s1","s2":"s2"}}, but in the TEXT, how to binding the json s2 ? {aaa.s2} is not work.
thank
Vadim
Posts: 409
Joined: Tue Apr 23, 2013 11:23 am

Re: json data source binding

Post by Vadim »

Hello.
This will be fixed in tomorrow pre-release build 2016.1.3
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: json data source binding

Post by heqichao »

Vadim
Posts: 409
Joined: Tue Apr 23, 2013 11:23 am

Re: json data source binding

Post by Vadim »

Hello.
You use wrong JSON format. Your JSON must look like:
{"weatherinfo":[{"city":"??","cityid":"101010100","temp1":"-2?","temp2":"16?","weather":"?","img1":"n0.gif","img2":"d0.gif","ptime":"18:00"}]}

Here other example http://northwind.servicestack.net/query/customers.json
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: json data source binding

Post by heqichao »

Thanks ! It is working !
can you show me the java code to set the json datasource?
Post Reply