How to: |
You can include sort-based options such as subtotals and other summary lines, sort headings and footings, underlines, skipped lines, and page breaks, as well as restart page numbering, by using the ON phrase in your report request. The ON phrase specifies an option that can be triggered by the change in a sort field or display field. The sort-based option (summary line, underline, skipped line, or page break) is applied to each sort group.
To make report requests flexible, options may be included that are not needed in every situation. User selections then control the options used for each execution of the request.
By default, if the field referenced in the ON phrase is not present in the request, or if the option is not supported with the type of field specified, the following message is generated and processing terminates:
(FOC013) The 'ON FIELDNAME' FIELD IS NOT A SORT FIELD: sortfield
You can use the SET ONFIELD =IGNORE command to instruct WebFOCUS to ignore ON phrases that reference absent fields or fields that are not supported by the specified option.
Note that any field used must be present in the Master File for the data source or the following message is generated and execution terminates:
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: field
{BY|ON} sortfield option [[AND] option ...]
where:
These are functionally identical. The only difference is syntactic (BY enables you to specify the sort-based feature as part of the sort phrase, while ON enables you to specify it separately from the sort phrase). For more information, see the documentation for the sortfield option you are using.
Is the name of a vertical sort (BY) field.
Is one of the following sort-based features: PAGE-BREAK, PAGE-BREAK REPAGE, RECAP, RECOMPUTE, SKIP-LINE, SUBFOOT, SUBHEAD, SUBTOTAL, SUB-TOTAL, SUMMARIZE, UNDER-LINE.
Can be included between two sets of sortfield options to enhance readability.
SET ONFIELD = {ALL|IGNORE}
ON TABLE SET ONFIELD {ALL|IGNORE}
where:
Issues a message and terminates execution when a field referenced in an ON phrase is not present in the request. ALL is the default value.
Ignores ON phrases that reference fields that are not present in the request, as well as ON phrases that include options not supported by the type of field specified.
The following request against the EMPDATA data source has ON phrases for the fields DEPT, DIV, and PIN. PIN is a sort field, but the other sort field must be entered at run time as the amper variable &F1:
SET USER = EUSER TABLE FILE EMPDATA SUM SALARY BY &F1 BY PIN ON DEPT SKIP-LINE NOSPLIT ON &F1 SUBTOTAL ON DIV PAGE-BREAK ON TABLE SET ONFIELD ALL END
Run the request supplying the value DEPT for the variable &F1. The following messages are generated:
ERROR AT OR NEAR LINE 8 IN PROCEDURE IGNORE3 FOCEXEC * (FOC013) THE 'ON FIELDNAME' FIELD IS NOT A SORT FIELD: DIV BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT
Now change the value of the ONFIELD parameter to IGNORE and run the request again, supplying the value DEPT for the variable &F1. The partial output is:
DEPT PIN SALARY ---- --- ------ ACCOUNTING 000000070 $83,000.00 000000100 $32,400.00 000000300 $79,000.00 000000370 $62,500.00 000000400 $26,400.00 *TOTAL ACCOUNTING $283,300.00 ADMIN SERVICES 000000170 $30,800.00 000000180 $25,400.00 *TOTAL ADMIN SERVICES $56,200.00