SQL/MX Report Writer Guide
Customizing a Report
HP NonStop SQL/MX Report Writer Guide—527194-002
4-56
Calculating Subtotals on Conditional Values
+> QTY_ORDERED AS I8 HEADING 'QUANTITY',
+> UNIT_PRICE * QTY_ORDERED AS F14.2
+> HEADING 'TOTAL PRICE' NAME TOTALP ;
S> BREAK ON CUSTNUM, OD.ORDERNUM;
S> SUBTOTAL QTY_ORDERED, TOTALP OVER OD.ORDERNUM;
S> SUBTOTAL TOTALP OVER CUSTNUM;
S> LIST ALL;
Calculating Subtotals on Conditional Values
The value in a column specified by using an IF/THEN/ELSE clause is in character
format and cannot be subtotaled or totaled by using the SUBTOTAL or TOTAL
command. You can use the UNION operator to specify a select list column that
contains a conditional value and can be subtotaled.
Figure 4-21. Customer Orders Summary
700510143 4000.00255 4 16000.00
9195.00
* * *
34 9195.00
* * *
123 200490
* * *
5505
3210
350.00
715.00
1
1 715.00
350.00
2 1065.00
300380
2405
2402
244 3000.00
320.00
760.00 8
12
16
18000.00
3840.00
6080.00
* * *
36 27920.00
* * *
28985.00
.
.
.
.
.
.
.
.
.
.
.
.
21 200320 5504 165.00 5 825.00
6400
6301
6201
540.00
245.00
195.00
7
6
16
3780.00
1470.00
3120.00
CUSTNUM
ORDERNUM PARTNUM
PRICE QUANTITY
TOTAL PRICE
VST0422.vsd