SQL/MX Report Writer Guide

Customizing a Report
HP NonStop SQL/MX Report Writer Guide527194-002
4-34
Numeric Values
Numeric Values
Use the I and F display descriptors for numeric values. In this example,
QTY_RECEIVED appears in the detail line. The data type defined for QTY_RECEIVED
is NUMERIC (7); the value is always an integer. By default, the display format is I11.
The DETAIL command specifies a narrower field.
>> SELECT * FROM PARTSUPP;
S> DETAIL PARTNUM,
+> QTY_RECEIVED AS I6 HEADING 'QTY' CENTER,
+> PARTCOST * QTY_RECEIVED HEADING 'TOTAL COST' CENTER;
S> LIST NEXT 2;
PARTNUM QTY TOTAL COST
------- ------ --------------------
212 20 40000.00
212 35 66500.00
S>
This DETAIL command includes an expression in COL 4 that results in a fixed-point
number. The AS clause specifies a field 10 single-byte characters wide with 4 digits
appearing to the right of the decimal point. This example uses an interim table created
under Row Value as Percent of All Row Values on page 3-35.
>> SELECT E.DEPTNUM, EMPNUM, SALARY, SALARY/AVGSAL*100.00
+> FROM EMPLOYEE E, AVGTEMP A
+> WHERE E.DEPTNUM = A.DEPTNUM;
S> DETAIL DEPTNUM, EMPNUM,
+> SALARY AS F10.2,
+> COL 4 AS F10.4 HEADING 'PCT OF AVG';
S> LIST NEXT 6;
DEPTNUM EMPNUM SALARY PCT OF AVG
------- ------ ---------- ----------
9000 1 175500.00 165.1765
1000 23 137000.00 263.4617
3000 29 136000.00 240.1766
2000 32 138000.40 276.0008
3200 39 75000.00 211.6970
3100 43 90000.00 225.8809
S>
In a DETAIL command print item, the AS clause must precede the HEADING and
NAME options.
In this example, the scale-sign descriptor specifies a scale factor for a very large
number. The total cost value is scaled to thousands of dollars. The descriptor -3P
specifies a scale factor of 10** -3 (or 0.001).