Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

3.03 Adding and Customizing Groups

Adding and Customizing Groups

Just like sort fields, multiple fields can also be used for creating groups. Each field is given its own group header and footer. An example of grouping on one field is a sales report that groups the sales people by their territory. If there are a lot of sales people within each territory, then you could add additional groups such as product category and sales manager. Each group added to the report categorizes the data to make it easier to quickly find what you are looking for.

To add a new group to the report, select the menu items Report > Group Expert. This displays the dialog box shown in Figure 3-5.



Figure 3-5. The Group Expert dialog box.

You can also show this dialog box by clicking on the Group Expert button on the Experts toolbar.



Figure 3-6. The Group Expert button.

The Group Expert has a lot in common with the Record Sort Expert. The left side shows the fields that are available for grouping and the right side shows the fields that have been selected. Move fields between the two sides by dragging and dropping them or by clicking on the arrow buttons.

The Group Expert has some new features that weren’t included in the Record Sort Expert. It lets you preview the current data in a field as well as search for field names within the available fields list. Clicking the Browse Data button at the bottom of the dialog box opens a new dialog box that shows the data for the currently selected field. Scroll through this list to verify that this is the data that you want to group on.

If you have a Memo field in your report, you might notice that it isn’t included in the list of available fields for grouping. That’s because Crystal Reports doesn’t allow creating a group on a Memo field. The same rule applies for sorting records – not allowed for Memo fields. As a workaround, create a formula based on the Memo field and then you can sort and group on the formula field. The formula can return the full Memo field unchanged or it can parse part of it if you just want to work with a portion of the data. Although the formula returns the exact same data as the original Memo field, Crystal Reports now lets you sort and group on it.

The Find Field button lets you search for a field in the list of available fields. This is useful for data sources that have many fields and you can’t quite remember the name of the field you want. By clicking the Find Field button you can type in part of a field name and it will find the field that matches what you entered.

The Find Field button doesn’t have a Find Next feature. Once it finds the first field that matches your text, clicking on the Find Field button won’t search any further. It just stays on the same field. To make it search the rest of the list, you have to manually click on the following field before clicking the Find Field button again.