Enform Plus Reference Manual

Clauses
Enform Plus Reference Manual422684-001
5-63
SUBTOTAL Clause
SUBTOTAL Clause
The SUBTOTAL clause allows you to specify the printing of a subtotal for a numeric
target-item. This clause is an optional part of the LIST statement. The syntax for
the SUBTOTAL clause is:
target-item
is a record name, a field name, a numeric literal, a predefined aggregate, a user
aggregate, an arithmetic expression, an IF/THEN/ELSE expression, a user table
name, a user variable, or a System Variable clause. The data type of the target-
item being subtotaled must be numeric.
by-item
is the name of a field grouped by a BY or BY DESC clause.
When the SUBTOTAL clause is specified, Enform Plus prints the subtotals for each
target-item within a by-item value. Enform Plus prints the subtotal in the
column of the target-item being subtotaled and precedes the subtotal by a row of
underline characters specified by the @UNDERLINE option variable. Enform Plus marks
the subtotal with a subtotal string specified by the @SUBTOTAL-LABEL option
variable. See the Option Variable Clauses
on page 5-48.
When a SUBTOTAL OVER clause is used, Enform Plus subtotals the target-item
each time the value of the specified by-item changes. When more than one
SUBTOTAL OVER clause is specified, Enform Plus prints the subtotals in the order that
the clauses are entered in the LIST statement.
When a SUBTOTAL clause is used without OVER, Enform Plus prints a subtotal in the
specified target-item column each time the value of any by-item appearing to the
left of the target-item changes. Enform Plus prints the subtotals using a minor-to-
major order precedence; that is, Enform Plus prints the subtotal for the first by-item to
the left of the target-item, followed by the subtotal for the second by-item to the
left of the target-item, and so on until the subtotal for the last by-item in the
report is printed.
SUBTOTAL does not generate a grand total at the end of the report. If a grand total is
desired, use the TOTAL clause. The TOTAL clause is described on page 5-71
.
If the width of the value of a subtotal exceeds the width of the format specified for a
target-item, an overflow condition occurs causing asterisks to be printed in place of
the value. To prevent this, enlarge the target-item display format by adding an AS
clause to the target-item being subtotaled. The AS clause is described on page 5-7
.
target-item SUBTOTAL [ OVER by-item ]