You are here: Command Parameters > GroupBy

GroupBy

The GroupBy parameter allows a field or expression to be specified in a command that causes a break in reporting results for the command each time the value of the specified field or expression changes. Subtotals are generated for each value in the group field.

Note: An Expression can consist of a concatenation of more than one field.

GroupBy fields must be character fields. To use a numeric field, convert it to a character field using the STRING() function. The GroupBy parameter can be used only with the following commands: Age, Classify, Histogram and Stratify.

Note: For meaningful results, your file should be sorted or indexed on the specified group field. Alternatively, you can use the Presort parameter in command mode or select the Presort On Group Field checkbox in the command dialog.

For information on using the GroupBy parameter on columns in Views and reports, see Modifying Columns and Group By Columns.

Command Mode Syntax

GROUPBY fields

In the following example, results of the Stratify command are displayed by product class. Separate totals are generated for each product class in the source file.

STRATIFY ON QtyOH ACCUMULATE Value MINIMUM 25 MAXIMUM 100 INTERVALS 10 GROUPBY ProdCls PRESORT TO SCREEN¿

Command Dialog Box

The GroupBy parameter is available by clicking the [More] button in a command dialog. To specify a group field, check the “Group By” checkbox and select a field from the pull-down list. Select the Presort checkbox to have presort the data on the group field.

To specify an expression, click [Choose] and then [Expression] to call up the Expression Builder. You can build an expression consisting of more than one field by clicking field names and concatenating them with a plus sign (+). Field names must be surrounded by quotes. For more information, see Expression Builder.