nazaf Posted January 15, 2016 Share Posted January 15, 2016 I have been trying to fetch data from two objects. I have json data where there are 5 objects, out of which 1 has values as an array. I am successfully able to fetch data from the object which has value has an array and use the fields in my report. But,i was trying to get a field from the 1st object as well which on using comes as null. I am posting the image. These 3 fields i am using in my report. i want the field 'name' from 1st object to be used with the report but i am not being able to do so. Can someone please help me out here? Regards,Nazaf Link to comment Share on other sites More sharing options...
mehmetydm Posted March 22, 2016 Share Posted March 22, 2016 I need exacly same thing. Nodes can be different type of object and nested. So how we can access them in one datasource. Link to comment Share on other sites More sharing options...
narcism Posted September 13, 2016 Share Posted September 13, 2016 It is possible, but with some effort if you are willing to use the current implementation of JSON data source.An easier solution is to wait for the 6.3.1 release of the JasperReports Library and the JasperSoft Studio where we have createad a new JSON query language meant to solve issues like this. A new sample with extensive documentation will be available in the Data Source / Query Executer section of the sample reference page(http://jasperreports.sourceforge.net/sample.reference.html) once the JasperReports Library 6.3.1 release is out.If you are tight to the current JSON implementation, these are the main steps to achieve what you want:use an empty query as the queryStringcreate a field with the "city.name" descriptioncreate a subDataset(for e.g. name it ListSubDataset) with the "temp.day", "temp.min", "temp.max" for the descriptions of the fieldscreate a list that uses the ListSubDataset and pass it a dataSource expression like this one:<datasetRun subDataset="ListSubDataset"><dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("list")]]></dataSourceExpression></datasetRun>A working example with subDatasets and lists can be found here:http://community.jaspersoft.com/jasperreports-library/issues/2500-0or herehttp://community.jaspersoft.com//questions/825620/how-deal-json-list-jsondatasource Link to comment Share on other sites More sharing options...
Recommended Posts
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