puperzenkarl Posted May 4, 2009 Share Posted May 4, 2009 I need some help with data grouping!!!!Given is the following object tree:Result has many GroupsGroups has many Groups or RecordsResult, 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? Group1Group1.1RecordRecordGroup1.2Group 2Record Post Edited by puperzenkarl at 05/04/2009 12:18 Link to comment Share on other sites More sharing options...
teodord Posted May 4, 2009 Share Posted May 4, 2009 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 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