SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-18
Labeling Information
The width of the display field for a print item that is a table or view column is
determined by the default display format for the data type of the column. You can
override the default width by specifying an AS clause: for example, CONCAT
(FIRST_NAME, SPACE 1, LAST_NAME) AS A25.
You cannot use an AS clause with columns of the INTERVAL data type. For more
information about displaying totals and subtotals on columns of the INTERVAL data
type, see Calculating Totals
on page 4-49.
For more information about the AS clause and default display formats, see Formatting
Data Values on page 4-28.
A centered heading might not appear to be centered if the left-justified values are
followed by blanks.
A report can include multiple-line headings. You indicate where the line breaks occur
by using the current new-line character. The default NEWLINE_CHAR value is a slash
(/).
The following commands define a supplier parts summary that contains multiple line
headings. The command that selects the data follows:
>> SELECT *
+> FROM SALES.PARTS P, INVENT.PARTSUPP PS, INVENT.SUPPLIER S
+> WHERE P.PARTNUM = PS.PARTNUM AND PS.SUPPNUM = S.SUPPNUM
+> ORDER BY S.SUPPNUM, P.PARTNUM;
The following commands define the detail line and display the first row of output:
S> DETAIL P.PARTNUM HEADING "Part/Number" CENTER,
+> QTY_AVAILABLE HEADING "Available/Units" CENTER,
+> PARTCOST HEADING "Unit Cost/(dollars)" CENTER,
+> PARTCOST * QTY_AVAILABLE
+> HEADING "Total Cost/(dollars)" CENTER;
S> LIST N 1;
Part Available Unit Cost Total Cost
Number Units (dollars) (dollars)
------ ----------- ------------ --------------------
212 3525 2000.00 7050000.00
S>
You can specify a different new-line character as follows:
>> SET STYLE NEWLINE_CHAR "!";
The first line of the preceding DETAIL line must then be changed as follows:
S> DETAIL P.PARTNUM HEADING "Part!Number" CENTER,
Titles
A report can contain three types of titles: