Cascading page breaks (on Interior Groups)

Tuesday 17 June 2008 @ 9:24 am

Say you have 2 group levels in your report Customer and Product. You have subtotals at the end of each group, so you have 2 levels of subtotals. What do you do if you want to have a page break after each product? Your first attempt would be to simply go into the section expert for GF2 and check “New Page After”. This works fine except for the last product in each Customer. The Customer’s subtotals would end up printing on the top of the next page, which would be a different Customer’s page. So you add the same “New Page After” setting to GF1. Now the Customer subtotals end up on a page all by themselves. You probably want the Customer subtotals printing right below the last Product’s subtotals. To get this effect you keep the check mark in the “New Page After” of Group 1, but you change the “New Page After” for Group 2 to be a condition formula. The formula would be:

{Table.Customer} = Next ( {Table.Customer} )

Note that this is the condition for Group Footer 2 but it uses the field for Group1. The formula says that Group 2 is allowed to do the page break as long as the report is not on the last product of the Customer. (If the Customer is the same as the next record’s Customer then you CAN’T be on the last product of the Customer.) The reason you don’t want to do a page break on the last Product of the Customer is because that page break is taken care of by Group Footer #1.

This method can be used regardless of the number of groups. Group Footer 1 always has the “new page after” checked. Every other group has a condition formula like the one above. Each condition uses the field of the next group ‘up’ in the hierarchy. Group Footer 3 would refer to the field used in Group 2, etc.

(For examples of my most popular formulas, please visit the FORMULAS page on my website.)

Leave a Reply

Recrystallize Pro

Crystal Reports Server