Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

3.06 Formatting Groups

Formatting Groups

The default layout for groups is that they print one after the other. When the group footer is printed, the subsequent group’s header is printed right after it. Some reporting requirements require changing this default behavior. For example, an invoicing report is designed so that it is grouped by client and each client gets their own invoice. For this report, you will put the client information in the group header section and force the group header to be printed at the top of a new page. The summary values appear in the group footer. The group footer is set to always print at the bottom of the page.

The formatting options for groups are in the Section Expert dialog box. The Section Expert is discussed in detail in Chapter 8, but for now we are going to look at the options that are used with grouping.

To get to the Section Expert dialog box, right-click on the group section and select Section Expert. This opens the Section Expert dialog box which lists all the sections along the left side and the section properties are listed to the right. The properties of interest here are Print at Bottom of Page, New Page Before, New Page After, Reset Page Number After, and Keep Together.

Print at Bottom of Page

This forces a section to always print at the bottom of the page even if the detail records stop printing in the middle of the page. This is commonly set for the Group Footer section. It is useful for reports that print summary information (sub-totals, disclaimers, logos, etc.). It is also useful for form letters where the bottom of the page must have exact placement.

New Page Before / New Page After

These two properties are used to force the groups onto individual pages. This is so that you can split the reports apart and distribute them independently. For example, a report grouped on Employee ID can be broken apart and each employee can be given their own report without seeing any information about the other employees.

You can either set the New Page Before property for the Group Header or set the New Page After property for the Group Footer. Both give you the same results of splitting the groups onto separate pages. The only problem is that sometimes these options cause a blank page to be printed either at the beginning of the report or at the end of the report. I address this more fully in the Advanced Tutorials section because it requires writing formulas.

Reset Page Number After

This sets the page number back to 1 after the Group has been printed and is usually associated with the Group Header. It insures that the page number for each group starts at 1. Just like the New Page Before property, this is useful for reports that are separated and distributed to different parties.

Keep Together

The Keep Together property forces a section to stay on the same page. For example, if the group header has the Keep Together property enabled and the entire header can’t fit on the page, then it will be started at the top of the next page. The important thing to note is that this only applies to an individual section and it won’t take other sections into account.

TThe Keep Together property may cause a little confusion because there is another property which has similar characteristics and also has a similar name. It is the Keep Group Together property. Let’s look at what each property does and how they differ.

The Keep Group Together property looks at the entire group (its header, details and footer) and tries to keep them on the same page. If the entire group can’t fit on the remainder of the current page, then the group is started at the top of the next page. This is clearly different than the Keep Together property because that property only applies to a single section while the Keep Group Together property looks at multiple sections.

It’s important to note that the Keep Group Together property is in a totally different dialog box than the Keep Together property. The Keep Group Together property is in the Change Group Options dialog box (select Report > Group Expert > Options).

There are some rules associated with the Keep Group Together property. If a group starts in the middle of a page and it can’t be fully printed by the end of the page, then it starts printing at the top of the following page. If a group requires more than a full page to print, then it will start printing at the top of the following page and continue onto the next page. The Group Header will not be printed on the additional pages unless the property Repeat Group Header on Each Page is set (also in the Change Group Options dialog box). If a group is small enough to fit on the remainder of the page without being broken apart, it will do so. If you wish to always start a group on a new page then use the New Page After property on the Group Footer section.