Grouping Command Objects

See Also

You can create a Command hierarchy by grouping a Command object. When a Command object is grouped, the grouped fields are added to a grouping Command object that becomes the parent of the original Command object. In the resulting recordsets, the grouping Command object contains a row for each unique set of values of the grouped fields.

For example, if the Command object that you want to group is called Customers, you can specify to group by its "Country" Field object and name the grouping Command object "ByCountry." The resulting group hierarchy consists of a Command object named ByCountry that contains two fields: Country and Customers. This is illustrated by the following figures.

Original Customers Table

Customers Table Grouped ByCountry

A grouped-based hierarchy displays in the Data Environment outline view as a single Command object with two folders of fields, one for the grouping Command and the other for the original, or detail, Command object.

Note   The name of all grouping Command objects must be unique among all other Command objects within the current Data Environment. For example, if you are creating a group based on a Field object named country, a logical group name may be "ByCountry."

To group a Command object

  1. Right-click the Command object and click Properties on the shortcut menu to access the Command Properties dialog box.

  2. Click the Grouping tab, and then select Group Command Object. This indicates that this Command object is part of a group and enables other fields on the tab.

  3. Change the default Grouping Command Name for the grouped Command object to a more logical name, if preferred. For example, if you are grouping the Field objects in a Customers table by country, you might call the group "ByCountry."

    Note   The default name is CommandName_Grouping where CommandName is the name of the selected Command object.

  4. Select the grouping fields from the list appearing in the Fields in Command box. Choose either one field at a time by selecting the field and click > or click >> to select all fields simultaneously.

    -or–

    Alternatively, to deselect fields, select the field to remove and click <, or click << to deselect all fields simultaneously.

    Note   If no fields are available, the arrow buttons are disabled. In addition, if you use the Properties dialog box of a child Command object to establish a group, the fields that define the parent-child relationship must be included as fields for the group. The Data Environment designer prohibits these fields from being removed.

  5. Click OK to save the grouping and close the dialog box.