Introduction to ENFORM

Specifying Report Arithmetic
Using ENFORM to Produce Complete Reports
4–18 058051 Tandem Computers Incorporated
An example of using an arithmetic expression clause is to modify the report in Figure
4-18 to contain a new column of data items that is the result of multiplying the price
and inventory fields. The heading for the new column will be TOTAL COST and it can
be subtotaled and totaled by 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" new item
SUBTOTAL OVER suppnum TOTAL;
to generate the report in Figure 4-19.
Figure 4-19. Standard Report With Derived Fields
SUPPNUM PARTNUM INVENTORY PRICE TOTAL COST
1 212 7 92000.00 64000.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
4103
7 24500.00 171500.00
* 16 302000.00
10 7102 20 6800.00
* 32 136800.00
62 1327000.00
Using Aggregate Clauses Aggregate clauses can be used to specify that a single type of value should be
computed and printed for a group of values. ENFORM provides five predefined
aggregate clauses:
AVG—the average value of a group of items
COUNT—the total number of occurrences of an item
MAX—the maximum value of an item
MIN—the minimum value of an item
SUM—the total sum of an item
An example of using an aggregate clause is to generate the average cost of all items in
stock for a particular supplier on the report in Figure 4-19.