Sets data item fields used to group records.
Data items on Classic report layouts
The GroupTotalFields is used with the TotalFields Property to maintain totals for one or more fields. Both group totals and the grand totals can be output by using the appropriate sections. Enter this property value as a comma-separated list of field names. The fields can be selected by using the AssistEdit button from the Value field of the property. Fields in the list must also be fields in the active key of the underlying table. If not, the report displaying the data items will not run.
When records are retrieved, they are grouped by the contents of the fields that are defined by the GroupTotalFields property. If more than one field is provided in the list, the groups are nested. This means that there is a group composed of records that have the same contents in the first field indicated. Inside of this group, records are grouped according to the contents of the second field in the list, and so on.
The GroupHeader section is output before a new group is started. The GroupFooter section is output after all records in a group are processed. The fields designated as TotalFields Property contain group totals for the last processed group. The group totals are printed by placing controls that have these fields as their source expressions in the GroupFooter section.
The TOTALSCAUSEDBY Function (Report) can be used to determine which field has changed contents, and thus which group is finished. Using this function is necessary if you define more than one field in GroupTotalFields and need to decide whether to output a GroupHeader or GroupFooter section.
When using the GroupTotalFields property, be aware of the relationship to the currently active key in the underlying table. Because the GroupTotalFields functionality is closely connected with the active key, some precautions might be required. For example, the No. and City fields are listed as GroupTotalFields while the active key consists of the No., Name, and City fields. If the contents of the Name field change as the records are processed, any grouping based on the City field will fail. Therefore, it may be necessary to prevent the user from choosing a key from the request form of the report, because the grouping only works with the one key that it was designed for. You can remove the request form by using the UseReqForm Property, or remove the Sort button by using the DataItemTableView Property property to set an explicit sorting order (key) for the data item.