The Display Clause
The optional display clause determines which fields (columns) are reported and how they are displayed. This clause is applicable to the LIST and SORT verbs only. If omitted, the query processor uses the default listing phrase to determine what is shown.
There are a wide variety of options in this clause. Some determine the actual layout of the data while others set breakpoints at which totals, averages, etc are to be reported.
Fields appear in the report left to right in the order of the display clause elements. The default view of the record id (@ID) is always shown as the leftmost column unless it is suppressed using the ID.SUP keyword. If there is no @ID dictionary item, the default action is to show this as 12 characters, left justified but this can be amended using the $QUERY.DEFAULTS record.
The display clause is constructed from the elements in the table below.
Each data item may optionally be prefixed by one of the qualifiers in the first column and followed by any number of compatible options from the third column.
Where no such item is defined in the dictionary or the VOC, the Fn or An data item is recognised by the query processor as a reference to field n, treating the data as single valued with a default format code of "15T". These display characteristics can be modified using other elements from the table above.
Qualified Display Clauses
For improved compatibility with other multivalue databases, QM supports the concept of qualified display clauses. These combine the role of the display clause with simple selection clause elements. Because qualified display clauses lead to a potential ambiguity in the interpretation of a query, this feature must be enabled using the QUALIFIED.DISPLAY mode of the OPTION command.
A qualified display clause element inserts a conditional test after the data item but before any items from the third column of the table above. This conditional test consists of an operator and a field or value against which the test is to be performed. It may not include the AND or OR operator or the use of brackets.
For example, the query
LIST STOCK SUPPLIER = 14 DESCRIPTION
would list the record id (default), SUPPLIER and DESCRIPTION fields, showing only those record where the SUPPLIER field contains 14. This is equivalent to
LIST STOCK SUPPLIER DESCRIPTION WITH SUPPLIER = 14
The Default Listing Phrase
If a query sentence contains no display clause, the query processor looks in the dictionary for a PH-type (phrase) entry named @. If this is found, it is attached to the end of the query sentence. Typically, this phrase contains a default list of fields to be shown but it may also include other query sentence elements. If there is no @ phrase, only the record id will be shown.
Where a report is directed to a printer by using the LPTR keyword, the query processor's search for a default listing phrase is extended by first looking for a phrase named @LPTR. If this is not found, the query processor uses the @ phrase as for reports directed to the screen. This extra stage allows users to set up a different set of default fields for the printer and the screen, usually because printers tend to be wider than the screen and can therefore fit more data.