Including an Element in a Heading or Footing

In this section:

You can customize a heading or footing by including:

Including a Field Value in a Heading or Footing

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:

Syntax: How to Include a Field Value in a Heading or Footing

<[prefix_operator]fieldname<fieldname[>]

or

<fieldname[>]

where:

<fieldname
Places the field value in the heading or footing, and suppresses trailing blanks in an alphanumeric field for all values of SET STYLEMODE.
<fieldname>
Places the field value in the heading or footing, and retains trailing blanks in an alphanumeric field if SET STYLEMODE = FIXED. Suppresses trailing blanks for all other values of SET STYLEMODE. PDF output retains trailing blanks regardless of the STYLEMODE setting.
prefix_operator
Performs a calculation directly on the value of a field. A prefix operator is applied to a single field, and affects only that field.

Note: To display the caret character (<) as text in a heading or footing, use two consecutive caret symbols (<<).

Example: 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.

Note: If you do not see the navigation arrows, click the maximize button.

Example: 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.

Example: 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.

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.

Example: 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.

Example: 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.

Example: 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

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.

Reference: 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.

Syntax: How to Include a Text Field in a Heading or Footing

<TEXTFLD

Example: 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.

  1. Create and save the Master File.
    FILENAME = TXTFLD, SUFFIX = FOC,$
    SEGNAME=TXTSEG, SEGTYPE = S1,$
       FIELDNAME = CATALOG, FORMAT = A10, $
       FIELDNAME = TEXTFLD,     FORMAT = TX50,$
  2. 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
  3. Run the MODIFY procedure to populate the data source.
  4. 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
  5. 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.

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.

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

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:

For details on Dialogue Manager variables, see the TIBCO WebFOCUS® Developing Reporting Applications manual.

Syntax: How to Include a Dialogue Manager Variable in a Heading or Footing

&[&]variable

where:

&
Introduces a local Dialogue Manager variable.
&&
Introduces a global Dialogue Manager variable.
variable
Is a variable whose value is supplied by the system or by a user at run time.

Example: 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:

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

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.