In Crystal Reports, using the Group Expert can help you do much more than just organizing the data on the page. Grouping in reports provides powerful functionality to allow report developers to order, display, aggregate, and transform data displayed in reports. The “Specified Order” functionality can be used in several different ways to affect the report’s presentation.
In this example, we will create an Expense Report to display the monthly expenses by expense account, grouped by cost center (001 for Reimbursable, 002 for Direct, and 003 for Non-Reimbursable). This is simple enough to do just by adding a group to the report. However, we want the order of the groups to be 002, 001 and 003. We will use the “Specified Order” option in the Group Expert to set this.
Open the Group Expert and create a group on the cost center field. With this group highlighted in the right pane, click the “Options…” button. On the “Common” tab, change from “in ascending order” to “in specified order” using the drop-down. This will open the new “Specified Order” tab. Click on the drop-down for the “Named Group” and select the groups in the order that they should be displayed.
Now that we have grouped the data, we would like to sum the amount by cost center, so insert a summary in the Group #1 Footer. Add the Group #1 Group Name field to the Group Footer as the label.
In this case, the three-digit cost center is not a very descriptive label. Back in the Group Expert, navigate to the “Specified Order” tab. Click on the Named Group “001” and click the “Edit” button. In the “Define Named Group” window, replace the Group Name “001” with “Reimbursable”. Add the remaining two groups in the same manner.
The report now displays the new Group Name for each group, in the order we specified. Using the “Specified Order” is an easy way both change the order that the groups display as well as changing the Group Name fields.