Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

4.07 Sorting Group Data

Sorting the Group Data

After creating the groups and running a test report, you may notice that although your groups are fine, the individual rows within the group are out of order. If this happens, it is because you still need to add sort fields to your report. Telling the report how to group data doesn’t imply that it knows which fields to use for sorting the detail records with. When using groups, the data within the group gets sorted according to how you set up the sort fields. If no sort fields are used, then the records appear in their natural order (which still may not be what you expect because the grouping process reorders the records as well). Look at the earlier section Sorting In a Specified Order for instructions on adding sort fields.

Changing the Field to Group On

Once your report is finished you might decide that the records need to be grouped differently or new report that looks the same but has different groups. For example, the original design of the sales report groups by region and it works fine. But you also need a similar report that groups by salesperson. Rather than redo the report from scratch, you can make a copy of the report and modify the group fields that need to change. Changing the group field is done via the Change Group dialog box.



Figure 4-6. The Change Group dialog box.

This dialog box can be accessed in two ways. The first way is to right-click on the group header bar and select Change Group. The other way is to click anywhere else on the report and select Report | Change Group Expert.

The groups are listed in their current order. You can use the arrow buttons to the right to rearrange their order. To modify a group field, click on the group and then click on the Options button. This brings up the Change Group Options dialog box mentioned earlier. Since this is the same dialog box you used to create the group, then you can also change any of the other group properties as well.

The Change Group dialog box lets you modify the existing groups, but you can’t add new groups with it. To do that, you have to right click on the report and select Insert | Group (as mentioned at the beginning of this section).