Including an Element in a Heading or Footing
You can customize a heading or footing by including:
- A field value. See Including a Field Value in a Heading or Footing and Including a Text Field in a Heading or Footing.
- A page number. See Including a Page Number in a Heading or Footing.
- A Dialogue Manager variable. See Including a Dialogue Manager Variable in a Heading or Footing.
- An image. See Including an Image in a Heading or Footing.
Including a Field Value in a Heading or Footing
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:
- ST. produces a subtotal value of a numeric field at a sort break in a report.
- CT. produces a cumulative total of a numeric field.
Include a Field Value in a Heading or Footing
<[prefix_operator]fieldname<fieldname[>]
<fieldname[>]
where:
Including the Department Name in a Page Heading and Footing
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.
Displaying a Less Than Symbol in a Heading
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.
Retaining Trailing Blanks in an Alphanumeric Field
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.
Using the Prefix Operator TOT in a Page Heading
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.
Using Multiple Prefix Operators in a 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.
Using Multiple Prefix Operators in a Sort Footing
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
Including a Text Field in a Heading or Footing
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.
Limits for Text Fields in a Heading or Footing
- You cannot embed a text field in a Financial Modeling Language (FML) report. For details, see Creating Financial Reports With Financial Modeling Language (FML).
- You cannot apply the StyleSheet attribute WRAP to a text field, since a text field is separated into multiple lines by the character count specified in the FORMAT attribute in the Master File.
Include a Text Field in a Heading or Footing
Including a Text Field in a Sort Footing
In this example, you create a Master File named TXTFLD.MAS and a corresponding FOCUS data source named TXTFLD.FOC.
- Create and
save the Master File.
FILENAME = TXTFLD, SUFFIX = FOC,$ SEGNAME=TXTSEG, SEGTYPE = S1,$ FIELDNAME = CATALOG, FORMAT = A10, $ FIELDNAME = TEXTFLD, FORMAT = TX50,$
- Create and
save the following MODIFY procedure. This procedure creates and populates
the data source in a Windows environment.
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
- Run the MODIFY procedure to populate the data source.
- Create and
save the following report request.
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
- Run the report
request.
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.
Including a Page Number in a Heading or Footing
You can include a system-generated page number in a heading or footing. For details, see Laying Out the Report Page.
Including a Dialogue Manager Variable in a Heading or Footing
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:
- System and statistical variables are predefined and their values are automatically supplied by the system when a procedure references them. System and statistical variables have names that begin with &. For example, &DATE generates the current date in report output.
- Local (&)
and global (&&) variables, whose user-defined values must
be supplied at run time:
- A local variable
retains its values during the execution of one procedure. Values
are lost after the procedure finishes processing. Values are not passed
to other invoked procedures that contain the same variable name.
A local variable is identified by a single ampersand followed by the variable name.
- A global variable
retains its value for the duration of the connection to the WebFOCUS Reporting Server and is passed from the execution of one invoked procedure
to the next.
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. - A local variable
retains its values during the execution of one procedure. Values
are lost after the procedure finishes processing. Values are not passed
to other invoked procedures that contain the same variable name.
For details on Dialogue Manager variables, see the ibi™ WebFOCUS® Developing Reporting Applications manual.
Include a Dialogue Manager Variable in a Heading or Footing
&[&]variable
Including the Current Date in a Report Heading
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:
Variable |
Display Format |
---|---|
&DATEtrMMDYY |
2002, December 11 |
&DATEMDYY |
12/11/2002 |
&DATEtrMDYY |
December 11, 2002 |
&DATEQYY |
Q4 2002 |
Including an Image in a Heading or Footing
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.