User guide

Specifying Computations for a Report
Developing an ENFORM Query
3–36 058058 Tandem Computers Incorporated
Report:
Part PCT
ORDERNUM Number QUANTITY QUANTITY
-------- ------ -------- --------
21 244 1 4.76
2001 2 9.52
2403 2 9.52
4103 2 9.52
25 244 1 4.76
5103 1 4.76
6301 2 9.52
6402 10 47.62
When the OVER ALL syntax is specified or assumed, ENFORM calculates percentage
values by performing the following:
1. ENFORM adds all of the values of the element modified by the PCT clause
together to obtain a total. In the preceding example these values are:
1, 2, 2, 2, 1, 1, 2, and 10. The total of these values is 21.
2. ENFORM then divides the value for each line of the report by the total to obtain
the percentage value. In the preceding example, the quantity value appearing on
the first line of the report is 1. Dividing 1 by 21 ( the total obtained in step 1)
results in a percentage value of 4.76.
The following example shows the PCT clause with the OVER syntax.
OPEN odetail;
LIST BY ordernum,
partnum,
quantity,
quantity PCT OVER ordernum,
WHERE ordernum LE 25;
Report:
ORDERNUM
Part
Number QUANTITY
PCT
QUANTITY
21
25
244
2001
2403
4103
244
5103
6301
6402
1
2
2
2
1
1
2
10
14.29
28.57
28.57
28.57
7.14
7.14
14.29
71.43
Percent of order 21
Percent of order 25