In this section: |
You can customize a heading or footing by including:
How to: |
You can include a field name in heading or footing text. When the request is run, the output includes the field value. The result is a customized heading or footing with specific data identification for the user.
While you can use this technique in any report, it is essential if you are creating a free-form report. For details, see Creating a Free-Form Report.
For requests with multiple display and sort field sets, fields in a report heading or footing, or page heading or footing, are evaluated as if they were objects of the first display command. Fields in a sort heading or footing are evaluated as part of the first display command in which they are referenced. If a field is not referenced, it is evaluated as part of the last display command.
You can use a prefix operator to derive a field value in a heading or footing. However, the DST., MDE., and MDN. prefix operators are not supported in headings or footings in requests that have an ACROSS phrase or multiple display commands. For a list of operations you can perform with prefix operators, see Displaying Report Data.
Two operators are specifically designed for use with a sort footing:
<[prefix_operator]fieldname<fieldname[>]
or
<fieldname[>]
where:
Note: To display the caret character (<) as text in a heading or footing, use two consecutive caret symbols (<<).
This request includes the field name DEPARTMENT in both the page heading and footing text. The command HEADING is not required in the request because the page heading text appears before the command PRINT.
TABLE FILE EMPLOYEE "<DEPARTMENT : BANK, EMPLOYEES AND SALARIES" PRINT CURR_SAL BY DEPARTMENT NOPRINT BY BANK_ACCT BY LAST_NAME BY FIRST_NAME ON DEPARTMENT PAGE-BREAK FOOTING "<DEPARTMENT EMPLOYEES WITH ELECTRONIC TRANSFER ACCOUNTS" ON TABLE SET ONLINE-FMT HTML ON TABLE SET WEBVIEWER ON ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The output displays the output for a multi-page HTML report. On the first page of output, the value of DEPARTMENT in the page heading and footing is MIS.
On the second page of output, the value of DEPARTMENT is PRODUCTION.
Note: If you do not see the navigation arrows, click the maximize button.
The following request computes the difference between REVENUE_US and COGS_US and displays those rows in which the difference is less than 100,000.
TABLE FILE WF_RETAIL_LITE HEADING CENTER " Difference << 100,000" " " SUM COGS_US REVENUE_US COMPUTE Difference/D20.2 = REVENUE_US - COGS_US; BY PRODUCT_CATEGORY WHERE TOTAL Difference LT 100000 ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The heading displays the text Difference < 100,000, as shown in the following image.
Trailing blanks are not retained in standard HTML output. When the output type is HTML, STYLEMODE is set to FULL by default. To retain trailing blanks in the alphanumeric field DEPARTMENT, the STYLEMODE setting has been changed to FIXED in this request and the delimiters < and > have been included around the field name in the sort footing text.
SET STYLEMODE = FIXED TABLE FILE EMPLOYEE SUM SALARY BY DEPARTMENT SUBFOOT "<DEPARTMENT> DEPARTMENT TOTAL SALARY IS <SALARY" ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
Values for DEPARTMENT appear in the sort footing as MIS and PRODUCTION.
Note: SET STYLEMODE=FIXED turns off the HTML formatting of your browser for that report. The resulting report displays in a fixed font without colors and other web capabilities.
This request uses the prefix operator TOT to generate grand totals for three fields.
DEFINE FILE SALES ACTUAL_SALES/D8.2 = UNIT_SOLD - RETURNS; SALES/F5.1 = 100 * ACTUAL_SALES / UNIT_SOLD; END TABLE FILE SALES "SUMMARY OF ACTUAL SALES" "UNITS SOLD <TOT.UNIT_SOLD" "RETURNS <TOT.RETURNS" "TOTAL SOLD <TOT.ACTUAL_SALES" " " "BREAKDOWN BY PRODUCT" PRINT UNIT_SOLD AND RETURNS AND ACTUAL_SALES BY PROD_CODE ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT PDF ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The totals appear in the page heading.
This request uses the prefix operators MAX, MIN, AVE, and TOT. It does not require a display command because the page heading text contains data fields.
TABLE FILE SALES "MOST UNITS SOLD WERE <MAX.UNIT_SOLD" "LEAST UNITS SOLD WERE <MIN.UNIT_SOLD" "AVERAGE UNITS SOLD WERE <AVE.UNIT_SOLD" "TOTAL UNITS SOLD WERE <TOT.UNIT_SOLD" ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The prefix operators generate summary data in the page heading.
This request uses the prefix operators CNT and AVE in a sort footing. The output does not contain columns of data. All data is included in the sort footing itself.
TABLE FILE EMPLOYEE BY DEPARTMENT NOPRINT SUBFOOT "NUMBER OF EMPLOYEES IN DEPARTMENT <DEPARTMENT = <CNT.LAST_NAME" "WITH AVERAGE SALARY OF <AVE.CURR_SAL" ON TABLE SET ONLINE-FMT HTML ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The sort footing is a summary report on the number of employees in a department and their average salary.
The prefix operators generate summary data in the page heading.
NUMBER OF EMPLOYEES IN DEPARTMENT MIS = 6 WITH AVERAGE SALARY OF $18,000.33 NUMBER OF EMPLOYEES IN DEPARTMENT PRODUCTION = 6 WITH AVERAGE SALARY OF $19,047.00
How to: |
Reference: |
You can include one or more text fields in a heading or footing. A text field has the attribute FORMAT=TXn in a Master File.
<TEXTFLD
In this example, you create a Master File named TXTFLD.MAS and a corresponding FOCUS data source named TXTFLD.FOC.
FILENAME = TXTFLD, SUFFIX = FOC,$ SEGNAME=TXTSEG, SEGTYPE = S1,$ FIELDNAME = CATALOG, FORMAT = A10, $ FIELDNAME = TEXTFLD, FORMAT = TX50,$
CREATE FILE TXTFLD MODIFY FILE TXTFLD FIXFORM CATALOG/10 TEXTFLD DATA COURSE100 This course provides the junior programmer with the skills needed to code simple reports.%$ COURSE200 This course provides the advanced programmer with techniques helpful in developing complex applications.%$ END
TABLE FILE TXTFLD BY CATALOG SUBFOOT "<TEXTFLD" ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF,$ ENDSTYLE END
The output is:
CATALOGCOURSE 100 This course provides the junior programmer with the skills needed to code simple reports COURSE 200 This course provides the advanced programmer with techniques helpful in developing complex applications.
The horizontal space occupied by the text field is determined by the number of characters specified in the FORMAT attribute in the Master File. In the sample Master File, TX50 means 50 characters wide.
Tip: Since the heading in this example includes a single embedded text field, the default alignment is satisfactory. However, to include text to introduce the embedded field or add another embedded field, you may align items in your output to improve readability.
You can include a system-generated page number in a heading or footing. For details, see Laying Out the Report Page.
How to: |
You can include a variable whose values are unknown until run time in a heading or footing. This technique allows you to customize the heading or footing by supplying a different value each time the procedure executes.
Variables fall into two categories:
A local variable is identified by a single ampersand followed by the variable name.
Because a new session is created on the WebFOCUS Reporting Server each time a request is submitted, values for global variables are not retained between report requests. This means that you can use the same global variable in more than one procedure as long as these procedures are called in the same request.
A global variable is identified by a double ampersand followed by the variable name.
Note: To avoid conflicts, do not name local or global variables beginning with Date, IBI, or WF. Variable names beginning with these values are reserved for Information Builder use.
For details on Dialogue Manager variables, see the TIBCO WebFOCUS® Developing Reporting Applications manual.
&[&]variable
where:
This request includes today's date on the second line of the report heading, highlighted in bold.
TABLE FILE GGSALES PRINT BUDDOLLARS DOLLARS BY STCD WHERE STCD EQ 'R1019' ON TABLE SUBHEAD "Sales Report for Store Code R1019" "&DATE" ON TABLE SET PAGE-NUM OFF ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF,$ TYPE=TABHEADING, LINE=1, FONT='TIMES', SIZE=10, STYLE=BOLD, $ TYPE=TABHEADING, LINE=2, COLOR=BLUE, $ ENDSTYLE END
The output is:
Note: You can modify the format of the date. Some formats are:
Variable |
Display Format |
---|---|
&DATEtrMMDYY |
2002, December 11 |
&DATEMDYY |
12/11/2002 |
&DATEtrMDYY |
December 11, 2002 |
&DATEQYY |
Q4 2002 |
A StyleSheet enables you to include an image in a heading or footing. An image, such as a logo, gives corporate identity to a report, or provides visual appeal.
For details on adding and positioning images, see Laying Out the Report Page.