DaveKay Posted March 23, 2015 Posted March 23, 2015 Hello all,I'm trying to build a report using a json data feed - while I can access the first level of data within the feed I am unable to access any second level data. I'm not entirely sure I am using the correct terminolgy so I have provided a screen capture of the data source record tree (see below). What I'm trying to do is auto discover the field under record.add_outlet.record tree node, when I hit next the field list is empty.This is a data source/set for a table within the report - ultimately I would like access the sub levels from a sub report. I have tried to find a solution using various forums and can only find reference to solutions involving net.sf.jasperreports.engine.data.JsonDataSource and subdataSource which I'm strugging to understand yet alone implement.I would appreciate any assiistance that could be provided. Should I continue to try and understand the JsonDataSource subDataSource approach or is there alternative solution?I am using Jaspersoft Studio 6.0.3.Kind RegardsDavid
ernestoo Posted March 24, 2015 Posted March 24, 2015 Can you post an example JSON? This is a good service for doing so https://gist.github.com/
DaveKay Posted March 24, 2015 Author Posted March 24, 2015 Thanks for taking a look ernestoo, the gist link is below - not used it before - just added an issue and pasted in the json, hope that's okay.https://github.com/DaveKay/SampleJSON/issues/1RegardsDavid
ernestoo Posted March 25, 2015 Posted March 25, 2015 So not 100% sure what you're looking to do but here is a little video explnation that might help you get going http://screencast.com/t/4uzHZ0tJojjh
DaveKay Posted March 25, 2015 Author Posted March 25, 2015 Thank you for that ernesto :-) I have just taken a look at the video and will try to apply what you have shown me. There are a few things there that I was not aware of. What I would like to do in the end is have a report that shows the top level inspection data and loops through the sub level records (add_an_outlet, add_an_inlet, add_defect records for each inspection in either a table or a sub report using the Parameter and the PARENT_ID and ID relationship. I really do appreciate you taking the time to create a step by step video for me...amazing! I'd better get to it - will let you know how I go.
DaveKay Posted March 25, 2015 Author Posted March 25, 2015 Okay ernesto - I was able to replicate what you showed me. I'm still however struggling to get either a table or a sub form populated with data. What I want to be able to is insert a table ( or a sub report ) that will report the 'add_an_outlet' records for each of the top level records. The add_an_outlet records are associated with the parent record via the PARENT_ID field. record.ID --> record.add_an_outlet.record.PARENT_RECORD_ID ( 1 to many ). I think what I need to do is similar to the sample described here; http://jasperreports.sourceforge.net/sample.reference/jsondatasource/ and the json data source sample in the Jasper Report Library. http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%206.0.3/jasperreports-6.0.3-project.zip/download Hopefully you get what I mean and can still assist. Kind Regards David
ernestoo Posted March 27, 2015 Posted March 27, 2015 Hi there ... essentially you are trying to do something similar to this article, it is quite similar for XML & JSON so should be helpful http://community.jaspersoft.com/wiki/accessing-nested-repeated-fields-your-xml-document - best of luck!
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