Jump to content
We've recently updated our Privacy Statement, available here ×

How can I access nested json records?


DaveKay

Recommended Posts

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 Regards

David

converted-file.png.b08cde5a08b27e0831993d30352bc03d.png

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

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.

 

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...