Inserting a New Group

To insert a new group into your report, right-click any blank area within your report and select Insert ^ Group. This opens the dialog shown in Figure 3-9.

The first choice you will need to make is which field you want to group on. This can be a database field, a formula field, or an SQL expression. Use the drop-down list provided to select a field. The fields that have been inserted onto your report will appear at the top of the list, and the fields from the database tables that have been added to your report will follow, regardless of whether these fields are used in the report or not. Remember, you don't need to actually show a field on your report to use it in a group.

Once you have selected the field you want to use, you will need to select the order for your group; by default, this is set to Ascending, which means your groups will be arranged from A-Z, 1-9, and so on. In Chapter 2, "Getting Started with Crystal Reports .NET, " we had a look at the different sorting orders available for groups, but here they are again for reference.

Sort Order



For ordering the data from A-Z, 1-9, and so on.


For ordering the data from Z-A, 9-1, and so on.


If your dataset is already sorted, this option will leave the data in its original sort order.


Used for creating your own custom groups and setting some criteria. Any records that meet the criteria would belong to the specified group.

Figure 3-9

And finally, at the bottom of the dialog are some grouping options that are optional. We'll look at these a little later in this chapter.

If you had selected a date or date-time field for your group, you would also have an additional option to set for how the groups would be broken down (by day, week, month, quarter, and so on).

For now, all you need to do to create a group is to select a field, pick a sort order, and click the OK button. If you were to add a group to the report we have been working on by using the Customer.Customer Name field, your group would be inserted onto your report, which would look something like Figure 3-10.

You'll notice that there are two additional sections added to your report for the group header and group footer, and a special field labeled "Group #1 Name" has been inserted in the group header.

This special field is called a Group Name field and is used to label the groups within your report. Remember in our earlier example when we had a group on a Product Class field? The Group Name field is used to display the name of each group, so from our earlier example it would display "Accessory" for the first group and then "Bicycle" for the second. Although this is a special field, you can customize the name that appears for each group, which we will also look at a little later in this chapter.

Figure 3-10

Was this article helpful?

0 0

Post a comment