Predefined Aggregates - Tandem ENFORM 058057 Reference Manual

Data management library
Table of Contents

Advertisement

ENFORM Language Elements
Aggregates

Predefined Aggregates

3–14
OVER
defines a range for the aggregate operations. The aggregate operation takes place
only over the specified over-item. The operation yields one aggregate value for
each unique value of over-item.
UNIQUE
excludes duplicate values from contributing to the collecting operation of the
aggregate. UNIQUE adds considerable processing overhead and should not be
specified unless you know unwanted duplicate values exist. UNIQUE is
redundant with MAX or MIN. While the same answer is returned when UNIQUE
is specified with these aggregates, processing time increases greatly.
The five predefined ENFORM aggregates are: AVG, COUNT, MAX, MIN, and SUM.
AVG finds an average value for a set of numbers. For each record containing a field
value to be averaged, the field value is added to the running total of the contributing
field values. After all contributing field values are processed, the final total is divided
by the number of field values that made up the total. The following example finds the
average of the partcost field over the suppnum field:
LIST BY suppnum,
AVG(partcost OVER suppnum);
COUNT tallies the instances of an element. In the following example, the number of
parts kept in stock are counted by counting the part numbers in parts:
OPEN parts;
LIST COUNT(partnum);
MIN determines the lowest number in a set of numbers or expressions. MAX
determines the highest number in a set of numbers or expressions. The following
example finds both the lowest and the highest price of a part:
OPEN fromsup;
LIST BY partnum,
MIN(partcost OVER partnum),
MAX(partcost OVER partnum);
SUM totals a set of numbers or expression values. In the following example, the sum
of the sales made by each salesman is obtained:
OPEN order,odetail,parts;
LINK order to odetail VIA ordernum;
LINK odetail to parts VIA partnum;
LIST BY salesman,
SUM (price * quantity) OVER salesman);
058057 Tandem Computers Incorporated

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enform

Table of Contents