ENFORM Reference Manual

Aggregates
ENFORM Language Elements
3–12 058057 Tandem Computers Incorporated
ENFORM allows you to reference nested data base tables. For example:
tot-sales Refers to month, top-dept, and the first
through last elements of wkly-sales within
the first element of tot-sales.
tot-sales[4].wkly-sales[2] Refers to the second element of wkly-sales
within the fourth element of tot-sales.
tot-sales[1:5].wkly-sales[3] Refers to the third element of wkly-sales
within the first thru fifth elements of tot-
sales.
tot-sales[2:3].wkly-sales[1:4] Refers to the first thru fourth elements of
wkly-sales within the second thru third
elements of tot-sales.
Aggregates An aggregate is the result of a cumulative operation performed for each value that
contributes to the aggregate. An aggregate yields a single value for the group of
values over which it is processed. Aggregates can only be specified as a target-item or
in a request-qualification. Aggregates specified as a target-item are called target
aggregates. Aggregates specified in a request-qualification are called qualification
aggregates.
ENFORM provides two types of aggregates: predefined and user-defined.
The syntax used for an aggregate is:
AVG
COUNT
MAX
MIN
SUM
user-aggregate
AVG
COUNT
SUM
MAX
MIN
user-aggregate
(
{}
field-name
expression
[]
OVER ALL
OVER
over-item
[ WHERE
logical-expression
])‚
( [ UNIQUE ]
field-name
[ OVER ALL ]
[ WHERE
logical-expression
])‚
AVG
is a predefined ENFORM aggregate that computes an average value for a set of
numbers or expressions.