Introduction to ENFORM

Specifying Report Arithmetic
Using ENFORM to Produce Complete Reports
058051 Tandem Computers Incorporated 4–19
Entering:
OPEN part, fromsup;
LINK parts TO fromsup VIA partnum;
LIST BY suppnum,
parts. partnum,
inventory SUBTOTAL OVER suppnum TOTAL,
price,
(price*inventory) HEADING "TOTAL COST"
SUBTOTAL OVER suppnum TOTAL,
AVG (price*inventory OVER suppnum);
will generate the report in Figure 4-20.
Figure 4-20. Standard Report With Aggregated Value
SUPPNUM PARTNUM INVENTORY PRICE TOTAL COST AVG
1 212 7 92000.00 64000.00 22250.00
244 3 87000.00 261000.00
6201 -16 5800.00 -92800.00
7301
32 2400.00 76800.00
26 889000.00
6 4102 9 14500.00 130500.00 151000.00
4103
7 24500.00 171500.00
16 302000.00
10 7102
20 6800.00 136800.00
32
136800.00
62 1327000.00
In this report, the average value of the items in the TOTAL COST column is computed
by taking the total value of items in the column and dividing it by the number of items
in the column.
In addition to the predefined aggregates, ENFORM supports user-defined aggregates
that extend your ability to specify report arithmetic. User-defined aggregates can
contain arithmetic and logical expression clauses. See the explanation of the
DECLARE statement in the ENFORM Reference Manual for an explanation of how to
specify this type of aggregate.