In this article I would like to describe steps that would allow you to create a report that uses a remote JSON data source to provide a data for your report.
Our test report will use a JSON data source:
http://resources.finance.ua/ua/public/currency-cash.json (One can use any other JSON data API).
To create our report in JasperSoft Studio we need to:
create Data Adapter that can retrieve information from the remote JSON Data Source
click Test button to be assured that the data can be retrieved
right click on the report name, select Dataset and Query and set our remote data source as the report’s data source (1), JSON as a query Language (2) , set a node from which the data should be extracted (3) and click Read fields (4)
a set of fields should be added to the fields area
add some of these fields to the Details band
set default data source for this report
run report and check the result of its execution
To export the report that has been created in the previous section we should:
export our Data Adapter to xml file
upload this data adapter to JasperReports Server
add to the jrxml report property that points to the data adapter
<property name="net.sf.jasperreports.data.adapter" value="repo:/public/case_67889/Remote_JSON_Data_Adapter.xml"/>
After this you can run your report in JasperReports Server:
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now