ENFORM User's Guide
Formatting a Report
Developing an ENFORM Query
3–44 058058 Tandem Computers Incorporated
The BEFORE or AFTER keywords of these clauses refer to the values printed, not to
the location of the printed information:
The BEFORE CHANGE clause obtains values to print from the last set of grouped
values printed; that is, the last value of the element before the by-item value
changes.
The AFTER CHANGE clause obtains values to print from the next set of grouped
values to be printed; that is, the first value of the element after the by-item value
changes.
The following example shows the use of both the AFTER CHANGE and BEFORE
CHANGE clauses:
DECLARE order-sum AS M
ZZZ,ZZZ,ZZ9.99
;
OPEN odetail,parts;
LINK odetail TO parts VIA partnum;
LIST BY ordernum, odetail.partnum,
(price * quantity) AS M
ZZZ,ZZZ,ZZ9.99
,
order-sum := SUM(price * quantity) OVER ordernum),
NOPRINT,
WHERE ordernum LE 25,
BEFORE CHANGE ON ordernum PRINT
"Before change on order " ordernum
" total order revenue is " order-sum,
AFTER CHANGE ON ordernum PRINT
"After Change on order " ordernum
" total order revenue is " order-sum;
Report:
Part
ORDERNUM Number
-------- ------
After Change on order 21 total order revenue is 158,200.00
21 244 87,000.00
2001 3,000.00
2403 19,200.00
4103 49,000.00
Before change on order 21 total order revenue is 158,200.00
After change on order 25 total order revenue is 115,800.00
25 244 87,000.00
5103 8,000.00
6301 5,800.00
6402 15,000.00
Before change on order 25 total order revenue is 115,800.00