Group a table by a field for page breaks

0

Hi Guys,

User Jaspersoft studio I have a table report of Sales Reps and their sales orders.

I would like page breaks groups by the first column (Sales Reps) so it prints a seperate sheet for each sales rep.

 

Is a group the best way to accomplish a page break based on a field?

I read the groups wiki:

https://community.jaspersoft.com/wiki/groups

But I don't really understand how to make grouping work with tables.

 

Seems like groups only work with the root dataset, but when I create a table it forces me to do a new dataset.

 

Thank you for your suggestions.

 

 

danoldenkamp@gmail.com's picture
Joined: Aug 29 2018 - 11:12am
Last seen: 12 hours 44 min ago

2 Answers:

0

Hi Dan,

I would use a group for the "outer" sales rep and set the flag "StartOnNewPage" to true. So each new grouping expression value will automatically create a pagebreak.

For "inner" records you could then use a SubDataSet for a table component or even a subReport. So this is - so my opinion - the easiest way for separating pages depending on a changed value.

When I remember right, the table component uses an own dataset, as it iterates itself through the records. You can't mix it with the main query, because then two elements would step through your records. You can use the main dataset in the title/summary band to use it within a table component, so that the dataset will iterate just once. But using it in detail or at group level will cause conflicts while stepping from one record to the next one.

hth + regards

C-Box

C-Box's picture
1967
Joined: Jul 19 2006 - 5:58pm
Last seen: 20 sec ago
0

Thank you!

I see that groups can be nested under groups similiar to SQL Report Writer.  

I set one group to be the Sales Rep with each on a new page.

The other group was by sales orders and the details had the line items.

Perfect!   Thank you!

danoldenkamp@gmail.com's picture
Joined: Aug 29 2018 - 11:12am
Last seen: 12 hours 44 min ago
Feedback