Topics: |
In the previous section, you learned how to include a heading before each new section of a report. Now you learn how to include a footing at the end of a section, just before a new sort field value and section begins. The command you use to achieve this is SUBFOOT.
You can use SUBFOOT, in conjunction with a sort field you specify, to produce section footings. These footings are displayed each time the specified sort field value changes. You can use the ON TABLE PAGE-BREAK AND SUBFOOT command to produce a footing that appears only once at the end of the report and on a trailing page.
The format of the SUBFOOT command is:
ON {sort_field|TABLE} [PAGE-BREAK AND] SUBFOOT "text"
You provide the text for the section footing.
Here is an example that demonstrates the difference between a section heading and section footing.
Issue the following request:
TABLE FILE EMPLOYEE SUM ED_HRS BY DEPARTMENT BY CURR_JOBCODE ON DEPARTMENT SUBHEAD " " "BEGINNING OF SECTION" " " ON DEPARTMENT SUBFOOT "END OF SECTION" END
Run the request. The output is:
You may recall from Creating Subtotals and Grand Totals, that you were able to display total and subtotal summary lines on a conditional basis, using WHEN. You can also use WHEN to control when section headings and footings are displayed.
You include WHEN to display section headings and footings only when the condition or conditions you specify are satisfied. You can include multiple WHEN conditions in a request.
The format for using WHEN with SUBFOOT is:
ON sort field SUBFOOT "text" WHEN expression
You include in the expression the same sort field from the ON command in the first line and the condition that sort field must satisfy. Only when the condition is met will the section footing for that sort field be included.
In addition to SUBFOOT, you could use SUBHEAD, or a number of other commands not reviewed in this Primer. For a complete list of commands you can use with WHEN, see the User's Manual for your product.
Here is a scenario in which using WHEN is very helpful. Your company provides three (3) weeks of vacation for employees with a minimum base salary of $25,000. You produce a report that shows employee salaries in every department. To draw attention to those employees eligible for the additional vacation, you include a section footing that is only displayed for employees who have a salary of at least $25,000.
You include an additional level of detail by using the FIRST_NAME and LAST_NAME fields as variables. Earlier you used a system variable, TABPAGENO, to automatically include the correct page number, even though it changed. Here, you include a field name variable so that the appropriate first and last names of employees are displayed in the footing. The caret or less than symbol (<) signals that the next item in a heading object is a field name.
Issue the following request:
TABLE FILE EMPLOYEE PRINT LAST_NAME FIRST_NAME BY DEPARTMENT BY CURR_SAL ON CURR_SAL SUBFOOT "<FIRST_NAME <LAST_NAME IS DUE EXTRA VACATION" WHEN CURR_SAL GT 25000 ON DEPARTMENT SKIP-LINE END
Run the request. The output is:
Note: In order to display a caret symbol (<) in a heading object, use two consecutive caret symbols (<<).
WebFOCUS | |
Feedback |