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

Data grouping


puperzenkarl

Recommended Posts

I need some help with data grouping!!!!

Given is the following object tree:

Result has many Groups
Groups has many Groups or Records

Result, Group and Record are simple Java Beans. I want to print the data in this custom Result set to PDF using JasperReports. It should print group headers and the record details. But Jasper expects a flat Result set and uses group expressions for grouping. Is it possible to put my custom Result set into a report template?

 

Group1

Group1.1

Record

Record

Group1.2

Group 2

Record

 



Post Edited by puperzenkarl at 05/04/2009 12:18
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

 

You need to teach JR how to iterate through your hierachical data. Only YOU know what is the structure of your data and JR cannot figure out beforehand what you want to iterate on.

You'll need to use subreports. The master report will iterate on those Group beans, and for each Group a subreport will be needed to iterate through the children of each group.

Note that JR has built-in data source implementations to iterate through collections or arrays of JavaBeans. Check the /demo/samples/datasource sample and the /demo/samples/subreport sample, both shipped with the project source files.

 

If you wait for JR 3.5.1 (to be released in the next few hours), you could use a new list component instead of a surebport.

 

I hope this helps.

Teodor

 

 

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...