KnowledgeBase 00043: Report Styles and Overlays

Multivalue database products have some very powerful report generation tools
but are let down by the poor visual impact of single font tabular results.

There are some excellent tools available to work alongside multivalue
databases to construct visually appealing reports but even a simple change of
font or colour can significantly improve user perception.

Report Styles for Screen Reports

A query processor report can be considered as having lines that fall into
seven classes:

Heading

Column heading

Detail

Subtotal

Total

Footing

Other

For a report directed to the user's screen, QM allows a colour to be
assigned to each line class.
For example, a report might show the headings in bright blue but the rest of
the report in white. This feature requires that the terminal emulator colour
handling is correctly configured.

A report style definition record assigns foreground and background colours
to each line class. The record is an X-type VOC item where fields 2 onwards
contain lines such as

Heading=Bright blue,Black

where the two comma separated names are the foreground and background colours.
Only the first character of the line class name is needed. Thus the example
above could also be written as

Any item not specified in the report style definition takes its default
value from the "Other" line class

Other=White,Black

which itself defaults to the above settings if omitted.
A style definition is applied to a report by use of the STYLE keyword

LIST SALES STYLE RPT.FORMAT

where RPT.FORMAT is the name of the style definition. A default report style
can be set using the REPORT.STYLE command.

Report Styles for Printed Reports

Report styles can also be applied to reports directed to a PCL printer. In
this case, a third comma separated element in each field of the style
definition record holds a font weight. This can be given as a number in the
range -7 to +7 or as a PCL font weight name (ULTRA-THIN, EXTRA-THIN, THIN,
EXTRA-LIGHT, LIGHT, DEMI-LIGHT, SEMI-LIGHT, MEDIUM, SEMI-BOLD, DEMI-BOLD,
BOLD, EXTRA-BOLD, BLACK, EXTRA-BLACK, ULTRA-BLACK). The default font weight is
MEDIUM (numeric value 0).

Overlays

Overlays allow an application to place additional items, often graphics, onto
a printed page. Although they are available for all printed output, they are of
most use with the query processor.

An overlay is generated by a catalogued subroutine that is called automatically
at the start of each page of output. The subroutine name is specified in the
OVERLAY option of SETPTR or a query processor command.

The subroutine takes a single argument which is the print unit number and
emits control strings using the PRINT statement. For PCL printers, QM includes
some useful PCL control string functions.

The above subroutine draws a box around an A4 sized page on a PCL printer.
Note how it saves the cursor position to ensure that subsequent application
output appears at the correct place.

Because the subroutine is called before any other output to the page, it is
possible for the subroutine to make other changes to the page settings.
Note in the above example how the left margin is indented to bring the
application output away from the left edge of the box.

This example is very similar to use of the BOXED option to the query
processor commands.