Whenever you add a group to a Crystal Report, Crystal creates and inserts a field called the “Group Name” as a heading for each group. These values are also what you see in the group tree along the left of the screen. In most cases the group name simply shows the values of the group field, but there exceptions. For instance, when you group on a date field you can choose to group “for each month” or “for each year”. The group name would display only the month or year from the field. If you do a TopN or use Specified Order you may get a final group called “Others”.
Crystal also gives you the ability to customize the group name. You can either pick a different database field to display as the group name, or you can write a formula to be the group name. For instance you might group by a Customer ID, but choose the Customer Name field as the group name. Or you might group by Employee ID, but create a formula that combines First Name and Last Name to be the Group Name.
To make this happen you go into Group Options (Report > Group Expert, Options button then Options tab) and check “Customize Group Name Field”. You will be given the choice of selecting another database field or creating a formula expression using the X+2 condition button.
Here’s a tip – when I want to use a formula expression for a group name, I typically write the formula as a separate formula field. Once that is saved I will go into the group options and put my formula field into the condition formula. If the logic ever needs to be changed it is simpler to modify a formula field than it is to get into the expression editor within the Group Options.
Note that you can also customize group names in cross-tabs, using the “Group Options” button for either the row or column fields. The interface is the same.