Creating Headings and Footings

In this section:

There are several types of headings and footings:



x
Limits for Headings and Footings

The following limitations apply to report headings and footings, page headings and footings, and sort headings and footings:


Top of page

x
Extending Heading and Footing Code to Multiple Lines in a Report Request

How to:

A single line heading or footing code, between double quotation marks, can be a maximum of 32K characters. However, in some editors the maximum length of a line of code in a procedure is 80 characters. In cases like this, you can use the <0X spot marker to continue your heading onto the next line. The heading or footing content and spacing appears exactly as it would if typed on a single line.

Even if you do not need to extend your code beyond the 80-character line limit, this technique offers convenience, since shorter lines may be easier to read on screen and to print on printers.



x
Procedure: How to Extend Heading or Footing Code to Multiple Lines in a Report Request

To extend the length of a single-line heading or footing beyond 80 characters:

  1. Begin the heading or footing with double quotation marks.
  2. Split the heading or footing content into multiple lines of up to 76 characters each, using the <0X spot marker at any point up to the 76th character to continue your heading onto the next line. (The four remaining spaces are required for the spot marker itself, and a blank space preceding it.)
  3. The heading or footing line can contain a maximum of 410 characters, with each line ending in an <0X spot marker.
  4. Place the closing double quotation marks at the end of the final line of heading or footing code.

You can use this technique to create a report heading or footing, page heading or footing, or sort heading or footing of up to 410 characters. For an illustration, see Extending Heading and Footing Code to Multiple Lines in a Report Request.



Example: Extending Heading and Footing Code to Multiple Lines in a Report Request

This request creates a sort heading coded on two lines. The <0X spot marker positions the first character on the continuation line immediately to the right of the last character on the previous line. (No spaces are inserted between the spot marker and the start of a continuation line.)

SET ONLINE-FMT = HTML
SET PAGE-NUM = OFF
JOIN STORE_CODE IN CENTCOMP TO STORE_CODE IN CENTORD
TABLE FILE CENTCOMP
HEADING
"Century Corporation Orders Report"
PRINT PROD_NUM QUANTITY LINEPRICE
BY STORE_CODE NOPRINT
BY ORDER_NUM
ON STORE_CODE SUBHEAD
"Century Corporation orders for store <STORENAME <0X
    (store # <STORE_CODE|) in <STATE|."
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
TYPE=HEADING, FONT='ARIAL', STYLE=BOLD, $
TYPE=SUBHEAD, OBJECT=FIELD, ITEM=2, STYLE=ITALIC, $
TYPE=SUBHEAD, OBJECT=FIELD, ITEM=3, STYLE=BOLD, $
ENDSTYLE
END

The partial output is:

Tip: You can use this technique to create a heading of up to 410 characters. Although demonstrated here for a sort heading, you can use this technique with any heading or footing line.


Top of page

x
Creating a Custom Report or Worksheet Title

How to:

You can create a report title that:

The worksheet tab names for an Excel Table of Contents report are the BY field values that correspond to the data on the current worksheet. If the user specifies the TITLETEXT keyword in the stylesheet, it will be ignored.



x
Syntax: How to Create a Custom Report Title

Add the following declaration to your WebFOCUS StyleSheet:

TYPE=REPORT, TITLETEXT='title', $

where:

title

Is the text for your title.

The maximum number of characters for:

  • The worksheet tab name in an EXL2K report is 31. Any text that exceeds 31 characters will be truncated.
  • The browser title for an HTML report or graph is 95. This is a limit imposed by the browser.

    Text specified in the title is placed in the file as is and is not encoded. Special characters, such as <, >, and &, should not be used since they have special meaning in HTML and may produce unpredictable results. Note: The words "Microsoft Internet Explorer" are always appended to any HTML report title.



Example: Creating a Custom Report Title in an HTML Report

The following illustrates how you can replace the default report title in an HTML report using the TITLETEXT attribute in your StyleSheet.

TABLE FILE SHORT
SUM PROJECTED REGION
BY REGION
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE * 
TYPE=REPORT, TITLETEXT='1999 Sales Report', $ 
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

The output is:



Example: Creating a Custom Report Title in an EXL2K Report

The following illustrates how you can replace the default worksheet tab name in an EXL2K report using the TITLETEXT attribute in your StyleSheet.

TABLE FILE SHORT
SUM PROJECTED_RETURN
BY REGION
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE * 
TYPE=REPORT, TITLETEXT='1999 Sales Report', $ 
ENDSTYLE
END

The output is:


Top of page

x
Creating a Report Heading or Footing

How to:

A report heading appears before the first page and is one of the most important components of a report. It provides a unique name to a report and identifies its purpose or content. A short, single-line report heading may meet the needs of your user, or you may include multiple lines of appropriate information.

A report footing appears after the last page of a report. You might add a report footing to signal the end of data so the user knows that the report is complete. A report footing can also provide other information, such as the author of the report.

A report heading or footing can include text, fields, Dialogue Manager variables, images, and spot markers.



x
Syntax: How to Create a Report Heading

Include the following syntax in a request. Each heading or footing line must begin and end with a double quotation mark.

ON TABLE [PAGE-BREAK AND] SUBHEAD
 "content ... "
["content ... "]
.
.
.
["content ... "]

where:

PAGE-BREAK
Is an optional command that creates the report heading on the first page by itself, followed by the page or pages of data. If you do not use PAGE-BREAK, the report heading appears on the first page of the report, followed by a page heading if one is supplied, and column titles. For related information, see Placing a Report Heading or Footing on Its Own Page.
SUBHEAD
Is the command required to designate a report heading.
content
Heading or footing content can include the following elements, between double quotation marks. (If the ending quotation mark is omitted, all subsequent lines of the request are treated as part of the report heading.)
text
Is text that appears on the first page of a report. You can include multiple lines of text.

The text must start on a line by itself, following the SUBHEAD command.

Text can be combined with variables and spot markers.

For related information, see Limits for Headings and Footings.

variable
Can be any one or a combination of the following:

Fields (real data source fields, virtual fields created with the DEFINE command in a Master File or report request, calculated values created with the COMPUTE command in a request, or a system field such as TABPAGENO). You can qualify data source fields with certain prefix operators.

Dialogue Manager variables.

Images. You can include images in a heading or footing.

For details, see Including an Element in a Heading or Footing.

spot marker
Enables you to position items, to identify items to be formatted, and to extend code beyond the 80-character line limit of some text editors.

<+0> divides a heading or footing into items for formatting. For details, see Identifying a Heading, Footing, Title, or FML Free Text.

</n specifies skipped lines. For details, see Controlling the Vertical Positioning of a Heading or Footing.

<-n to position the next character on the line. For details, see Using Spot Markers to Refine Positioning.

<0X continues a heading or footing specification on the next line of the request. For details, see Extending Heading and Footing Code to Multiple Lines in a Report Request.

Note: When a closing spot marker is immediately followed by an opening spot marker (><), a single space text item will be placed between the two spot markers (> <). This must be considered when applying formatting.

Blank lines
If you omit all text, variables, and spot markers, you have a blank heading or footing line (for example, " ") which you can use to skip a line in the heading or footing. (You can also skip a line using a vertical spot marker, such as </1.)


Example: Creating a Single-Line Report Heading

This request creates a single-line report heading that identifies the content of the report.

TABLE FILE GGSALES
PRINT BUDDOLLARS DOLLARS
BY STCD
WHERE STCD EQ 'R1019' 
ON TABLE SUBHEAD
"Sales Report for Store Code R1019" 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET WEBVIEWER ON
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END

The output illustrates the placement of a report heading on a multi-page HTML report. The report heading is at the top of the first page.

Subsequent pages do not contain a heading.

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



x
Syntax: How to Create a Report Footing

Include the following syntax in a request. Each heading or footing line must begin and end with a double quotation mark.

ON TABLE [PAGE-BREAK AND] SUBFOOT
 "content ... "
["content ... "]
.
.
.
["content ... "]

where:

PAGE-BREAK
Is an optional command that creates the report footing after the last page by itself. If you do not include PAGE-BREAK, the report footing appears as the last line of the report. For related information, see Placing a Report Heading or Footing on Its Own Page.
SUBFOOT
Is the command required to designate a report footing.
content
Heading or footing content can include the following elements, between double quotation marks. (If the ending quotation mark is omitted, all subsequent lines of the request are treated as part of the report footing unless you are using the <0X spot marker.)
text
Is text that appears on the last page of a report. You can include multiple lines of text.

The text must start on a line by itself, following the SUBFOOT command.

Text can be combined with variables and spot markers.

For related information, see Limits for Headings and Footings.

variable
Can be any one or a combination of the following:

Fields (real data source fields, virtual fields created with the DEFINE command in a Master File or report request, calculated values created with the COMPUTE command in a request, or a system field such as TABPAGENO). You can qualify data source fields with certain prefix operators.

Dialogue Manager variables.

Images. You can include images in a heading or footing.

For details, see Including an Element in a Heading or Footing.

spot marker
Enables you to position items, to identify items to be formatted, and to extend code beyond the 80-character line limit of the text editor.

<+0> divides a heading or footing into items for formatting. For details, see Identifying a Heading, Footing, Title, or FML Free Text.

</n specifies skipped lines. For details, see Controlling the Vertical Positioning of a Heading or Footing.

<-n to position the next character on the line. For details, see Using Spot Markers to Refine Positioning.

<0X continues a heading or footing specification on the next line of the request. For details, see Extending Heading and Footing Code to Multiple Lines in a Report Request.

Note: When a closing spot marker is immediately followed by an opening spot marker (><), a single space text item will be placed between the two spot markers (> <). This must be considered when applying formatting.

Blank lines
If you omit all text, variables, and spot markers, you have a blank heading or footing line (for example, " ") which you can use to skip a line in the heading or footing. (You can also skip a line using a vertical spot marker, such as </1.)


Example: Creating a Single-Line Report Footing

This request creates a single-line report footing that identifies the author of the report.

TABLE FILE GGSALES
PRINT UNITS
WHERE UNITS GE 1400
BY STCD BY REGION
WHERE REGION EQ 'Northeast' 
ON TABLE SUBFOOT
"AUTHOR: MARY SMITH" 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET WEBVIEWER ON
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END

The output illustrates the placement of a report footing on a multi-page HTML report. The report footing follows the data on the last page.

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


Top of page

x
Creating a Page Heading or Footing

How to:

Reference:

A page heading appears at the top of every page of a report, and a page footing appears at the bottom of every page.

Add a page heading to identify and reinforce the report content and purpose from page to page, or include a variable that customizes the heading on each page. For example, consider a report with employee bank account information, arranged by department. Information for each department appears on a separate page. The page heading for this report identifies the department addressed on each page (for example, ACCOUNT REPORT FOR PRODUCTION DEPARTMENT).

Add a page footing to supply information that warrants repetition on each page, such as the date of the report, or a reminder that it is confidential. You can also use a page footing to supply descriptive information about a report, such as PRELIMINARY or DRAFT COPY.

A page heading or footing can include text, fields, Dialogue Manager variables, images, and spot markers.

In addition, you can use page heading and footing syntax to create a free-form (non-tabular) report, in which you position data on a page using a layout of your own design. See Creating a Free-Form Report for details.

A TABLE request can have more than one page heading or footing. For each heading or footing, a WHEN clause against the data being retrieved can determine whether the heading or footing displays on the report output.

In a heading, the data for the WHEN clause and data field values displayed in the heading are based on the first line on the page. In a footing, the data for the WHEN clause and the data field values displayed in the footing are based on the last line on the page.

The CONDITION StyleSheet attribute enables you to identify a specific WHEN clause so that you can style each heading or footing separately. For information, see Identifying a Heading or Footing.



x
Syntax: How to Create a Page Heading

Include the following syntax in a request. Each heading or footing line must begin and end with a double quotation mark.

[HEADING [CENTER]]
 "content ... "
["content ... "]
.
.
.
["content ... "]

where:

HEADING
Is an optional command if you place the text before the first display command (for example, PRINT or SUM); otherwise, it is required to identify the text as a page heading.
CENTER
Is an optional command that centers the page heading over the report data. For details, see How to Center a Page Heading or Footing Using Legacy Formatting.
content
Heading or footing content can include the following elements, between double quotation marks. (If the ending quotation mark is omitted, all subsequent lines of the request are treated as part of the page heading.)
text
Is text for the page heading. You can include multiple lines of text.

The text must start on a line by itself, following the HEADING command.

Text can be combined with variables and spot markers.

For related information, see Limits for Headings and Footings.

variable
Can be any one or a combination of the following:

Fields (real data source fields, virtual fields created with the DEFINE command in a Master File or report request, calculated values created with the COMPUTE command in a request, or a system field such as TABPAGENO). You can qualify data source fields with certain prefix operators.

Dialogue Manager variables.

Images. You can include images in a heading or footing.

For details, see Including an Element in a Heading or Footing.

spot marker
Enables you to position items, to identify items to be formatted, and to extend code beyond the 80-character line limit of the text editor.

<+0> divides a heading or footing into items for formatting. For details, see Identifying a Heading, Footing, Title, or FML Free Text.

</n specifies skipped lines. For details, see Controlling the Vertical Positioning of a Heading or Footing.

<-n to position the next character on the line. For details, see Using Spot Markers to Refine Positioning.

<0X continues a heading or footing specification on the next line of the request. For details, see Extending Heading and Footing Code to Multiple Lines in a Report Request.

Note: When a closing spot marker is immediately followed by an opening spot marker (><), a single space text item will be placed between the two spot markers (> <). This must be considered when applying formatting.

Blank lines
If you omit all text, variables, and spot markers, you have a blank heading or footing line (for example, " ") which you can use to skip a line in the heading or footing. (You can also skip a line using a vertical spot marker, such as </1.)


Example: Creating a Single-Line Page Heading

This request omits the command HEADING since the page heading text precedes the display command PRINT. The page heading includes text and an embedded field.

TABLE FILE EMPLOYEE 
"ACCOUNT REPORT FOR DEPARTMENT <DEPARTMENT"
PRINT CURR_SAL BY DEPARTMENT BY HIGHEST BANK_ACCT
BY EMP_ID
ON DEPARTMENT PAGE-BREAK
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END

The output illustrates the placement of a page heading on a multi-page HTML report. The page heading appears on both pages of the report, identifying the department to which the data applies. See Including a Field Value in a Heading or Footing for information on embedded field values. The first page of data applies to the MIS department.

The second page of data applies to the PRODUCTION department.



x
Syntax: How to Create a Page Footing

Include the following syntax in a request. Each heading or footing line must begin and end with a double quotation mark.

FOOTING [CENTER] [BOTTOM]
  "content ... "
["content ... "]
.
.
.
["content ... "]

where:

FOOTING
Is the required command that identifies the content as a page footing.
CENTER
Is an optional command that centers the page footing over the report data. For details on CENTER, see How to Center a Page Heading or Footing Using Legacy Formatting.
BOTTOM
Is an optional command that places the footing at the bottom of the page. If you omit BOTTOM, the page footing appears two lines below the report data. For details on BOTTOM, see How to Position a Page Footing at the Bottom of a Page.
content
Heading or footing content can include the following elements, between double quotation marks. (If the ending quotation mark is omitted, all subsequent lines of the request are treated as part of the footing unless you are using the <0X spot marker.)
text
Is text for the page footing. You can include multiple lines of text.

The text must start on a line by itself, following the FOOTING command.

Text can be combined with variables and spot markers.

For related information, see Limits for Headings and Footings.

variable
Can be any one of, or a combination of the following:

Fields (real data source fields, virtual fields created with the DEFINE command in a Master File or report request, calculated values created with the COMPUTE command in a request, or a system field such as TABPAGENO). You can qualify data source fields with certain prefix operators.

Dialogue Manager variables.

Images. You can include images in a heading or footing.

For details, see Including an Element in a Heading or Footing.

spot marker
Enables you to position items, to identify items to be formatted, and to extend code beyond the 80-character line limit of the text editor.

<+0> divides a heading or footing into items for formatting. For details, see Identifying a Heading, Footing, Title, or FML Free Text.

</n specifies skipped lines. For details, see Controlling the Vertical Positioning of a Heading or Footing.

<-n positions the next character on the line. For details, see Using Spot Markers to Refine Positioning.

<0X continues a heading or footing specification on the next line of the request. For details, see Extending Heading and Footing Code to Multiple Lines in a Report Request.

Note: When a closing spot marker is immediately followed by an opening spot marker (><), a single space text item will be placed between the two spot markers (> <). This must be considered when applying formatting.

Blank lines
If you omit all text, variables, and spot markers, you have a blank heading or footing line (for example, " ") which you can use to skip a line in the heading or footing. (You can also skip a line using a vertical spot marker, such as </1.)


Example: Creating a Multiple-Line Page Footing

This request creates a two-line page footing that identifies the data as preliminary and indicates when the final report will be available.

TABLE FILE GGSALES
PRINT UNITS DOLLARS
BY CATEGORY BY STCD
WHERE TOTAL DOLLARS GE 25000 
FOOTING
"PRELIMINARY SALES FIGURES"
"FINAL TO COME END OF MONTH" 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET WEBVIEWER ON
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END

The partial output illustrates the placement of page footings on a multi-page HTML report. The page footing appears on both pages of the report.

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



x
Syntax: How to Specify a Heading or Footing With a WHEN Clause
{HEADING [CENTER]|FOOTING}
"text_and_data1"
   .
   .
   .
"text_and_datan"
WHEN expression 

where:

text_and_data1, text_and_datan
Is the text and data for each heading or footing line.
expression
Is an expression that resolves to TRUE or FALSE (1 or 0). If its value resolves to TRUE, the heading or footing is displayed. If the expression resolves to FALSE, the heading or footing is not displayed.


x
Reference: Usage Notes for Multiple Headings

Top of page

x
Freezing HTML Headings, Footings, and Column Titles

How to:

You may want to scroll the data in a report while freezing headings, column titles, and footings in order to see the context of the report output while scrolling.

Using StyleSheet attributes, you can set aside a scrollable area for HTML report output.



x
Syntax: How to Create a Scrollable Area in an HTML Report
TYPE=REPORT, HFREEZE={ON|TOP|BOTTOM|OFF}, [ SCROLLHEIGHT={4|nn[.n]}], $

where:

HFREEZE=ON
Freezes the heading, column titles, grand totals, and footing.
HFREEZE=TOP
Freezes the heading and column titles.
HFREEZE=BOTTOM
Freezes the grand totals and footing.
nn[.n]
Is the height, in inches, of the scrollable area. The default is 4 inches.


x
Reference: Usage Notes for Freezing Areas of HTML Report Output

Top of page

x
Creating a Sort Heading or Footing

How to:

Reference:

A sort heading is text that precedes a change in a sort field value, identifying the beginning of a group of related data. A sort footing is text that follows a change in a sort field value, identifying the end of a group of related data.

A sort heading or footing, which appears in the body of a report, helps you identify different areas of detail in a report. Sort headings or footings can include text, fields, Dialogue Manager variables, images, and spot markers.

By including a WHEN phrase in a request, you can generate a message, implemented as a sort heading or footing, for data that meets the criterion you define. For details on conditional formatting, see Controlling Report Formatting. For an illustration of this technique, see Creating a Conditional Sort Footing With Multiple Sort Options.

If you are using a RECAP command to create subtotal values in a calculation, you can replace the default RECAP label with a more meaningful sort footing by following the RECAP command for a field with a SUBFOOT command for that field. For details about the RECAP command, see Including Totals and Subtotals.

If one or more data fields are embedded in the sort footing, you can omit a display command from the report request since, by default, data fields in headings and footings are summed. If, however, a request does contain an explicit SUM command and a display field is also specified in the sort footing, the field in the sort footing is summed. For an illustration, see Omitting a Display Command in a Sort Footing. You can omit the display command from other types of headings and footings as well. Note that the data for headings is taken from the first sort group and the data for footings is taken from the last sort group. For related information, see Limits for Headings and Footings.

By default, WebFOCUS generates a blank line before a subheading or subfooting. You can eliminate these automatic blank lines by issuing the SET DROPBLNKLINE=ON command.



x
Reference: Alignment of Subheadings and Subfootings

By default, with SQUEEZE=ON, the right margin used for borders and backcolor for subheadings and subfootings is defined based on the maximum width of all heading, footing, subheading, and subfooting lines. The length of subheading and subfooting lines is tied to the lengths of the page heading and page footing, not to the size of the data columns in the body of the report. The ALIGN-BORDERS=BODY attribute in a StyleSheet allows you to align the subheadings and subfootings with the data/report body on PDF report output instead of the other heading elements.



x
Syntax: How to Create a Sort Heading

Each heading or footing line must begin and end with a double quotation mark, unless you are using the line continuation spot marker (<ox).

BY fieldname SUBHEAD [NEWPAGE]
 "content ... "
["content ... "]
.
.
.
["content ... "]
[WHEN expression;]
BY fieldname 
ON fieldname SUBHEAD [NEWPAGE]
 "content ... "
["content ... "]
.
.
.
["content ... "]
[WHEN expression;]

OR

BY fieldname 
ON fieldname SUBHEAD [NEWPAGE]
 "content ... "
["content ... "]
.
.
.
["content ... "]
[WHEN expression;]

where:

fieldname
Is the sort field before which the heading text appears.
content
Heading or footing content can include the following elements, between double quotation marks. (If the ending quotation mark is omitted, all subsequent lines of the request are treated as part of the heading.)
text
Is text for the sort heading. You can include multiple lines of text.

The text must start on a line by itself, following the SUBHEAD command.

Text can be combined with variables and spot markers.

For related information, see Limits for Headings and Footings.

variable
Can be any one of, or a combination of, the following:

Fields (real data source fields, virtual fields created with the DEFINE command in a Master File or report request, calculated values created with the COMPUTE command in a request, or a system field such as TABPAGENO). You can qualify data source fields with certain prefix operators.

Dialogue Manager variables.

Images. You can include images in a heading or footing.

For details, see Including an Element in a Heading or Footing.

spot marker
Enables you to position items, to identify items to be formatted, and to extend code beyond the 80-character line limit of the text editor.

<+0> divides a heading or footing into items for formatting. For details, see Identifying a Heading, Footing, Title, or FML Free Text.

</n specifies skipped lines. For details, see Controlling the Vertical Positioning of a Heading or Footing.

<-n to position the next character on the line. For details, see Using Spot Markers to Refine Positioning.

<0X continues a heading or footing specification on the next line of the request. For details, see Extending Heading and Footing Code to Multiple Lines in a Report Request.

Note: When a closing spot marker is immediately followed by an opening spot marker (><), a single space text item will be placed between the two spot markers (> <). This must be considered when applying formatting.

WHEN expression
Specifies a condition under which a sort heading is displayed, as determined by a logical expression. You must place the WHEN phrase on a line following the text.

For details on conditional formatting, see Controlling Report Formatting. For related information, see Using Expressions.

Blank lines
If you omit all text, variables, and spot markers, you have a blank heading or footing line (for example, " ") which you can use to skip a line in the heading or footing. (You can also skip a line using a vertical spot marker, such as </1.)

NEWPAGE
Inserts a new page after the sort heading. Column titles appear on every page.

You can use NEWPAGE with PDF reports.In HTML reports, blank space is added instead of a new page.



Example: Creating a Sort Heading When a Product Description Changes

This request displays a sort heading each time the product description changes. The sort heading includes text and an embedded field.

TABLE FILE GGPRODS
PRINT PACKAGE_TYPE AND UNIT_PRICE
WHERE UNIT_PRICE GT 50
BY PRODUCT_DESCRIPTION NOPRINT BY PRODUCT_ID 
ON PRODUCT_DESCRIPTION SUBHEAD
"Summary for <PRODUCT_DESCRIPTION" 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

The sort heading identifies the product that the next line of data applies to.

See Including a Field Value in a Heading or Footing for information on embedded field values.



Example: Creating a Conditional Sort Heading

This request displays a sort heading for a category only if its sales fall below $17,000,000.

TABLE FILE GGSALES
SUM DOLLARS 
BY CATEGORY SUBHEAD
"<CATEGORY ALERT: SALES FALL BELOW $17,000,000"
WHEN DOLLARS LT 17000000; 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

Sales for the category Gifts fall below the specified amount, as the sort heading warns. No other category is preceded by a sort heading.

See Including a Field Value in a Heading or Footing for information on embedded field values.



x
Syntax: How to Create a Sort Footing

Each heading or footing line must begin and end with a double quotation mark.

For a single sort field, use the syntax

BY fieldname SUBFOOT [WITHIN] [MULTILINES] [NEWPAGE]
 "content ... "
["content ... "]
.
.
.
["content ... "]
[WHEN expression;]
BY fieldname 
ON fieldname SUBFOOT [WITHIN] [MULTILINES] [NEWPAGE]
 "content ... "
["content ... "]
.
.
.
["content ... "]
[WHEN expression;]

For multiple sort fields, use the syntax

BY fieldname 
ON fieldname SUBFOOT [MULTILINES] [NEWPAGE]
 "content ... "
["content ... "]
.
.
.
["content ... "]
[WHEN expression;]

where:

fieldname
Is the sort field after which the footing text appears.
WITHIN
Causes the fields in the SUBFOOT to be calculated within each value of fieldname. Without this option, a field in the SUBFOOT is taken from the last line of report output above the subfooting.
MULTILINES
Suppresses the sort footing when there is only one line of data for a sort field value. (MULTI-LINES is a synonym for MULTILINES.)
content
Heading or footing content can include the following elements, between double quotation marks. (If the ending quotation mark is omitted, all subsequent lines of the request are treated as part of the sort footing.)
text
Is text that appears on the first page of a report. You can include multiple lines of text.

The text must start on a line by itself, following the SUBFOOT command.

Text can be combined with variables and spot markers.

For related information, see Limits for Headings and Footings.

variable
Can be any one or a combination of the following:

Fields (real data source fields, a virtual fields created with the DEFINE command in a Master File or report request, calculated values created with the COMPUTE command in a request, a system field such as TABPAGENO). You can qualify data source fields with certain prefix operators.

Dialogue Manager variables.

Images. You can include images in a heading or footing.

For details, see Including an Element in a Heading or Footing.

spot marker
Enables you to position items, to identify items to be formatted, and to extend code beyond the 80-character line limit of the text editor.

<+0> divides a heading or footing into items for formatting. For details, see Identifying a Heading, Footing, Title, or FML Free Text.

</n specifies skipped lines. For details, see Controlling the Vertical Positioning of a Heading or Footing.

<-n to position the next character on the line. For details, see Using Spot Markers to Refine Positioning.

<0X continues a heading or footing specification on the next line of the request. For details, see Extending Heading and Footing Code to Multiple Lines in a Report Request.

Note: When a closing spot marker is immediately followed by an opening spot marker (><), a single space text item will be placed between the two spot markers (> <). This must be considered when applying formatting.

WHEN expression
Specifies a condition under which a sort footing is displayed, as determined by a logical expression. You must place the WHEN phrase on a line following the text.

For details on conditional formatting, see Controlling Report Formatting. For related information, see Using Expressions.

Blank lines
If you omit all text, variables, and spot markers, you have a blank heading or footing line (for example, " ") which you can use to skip a line in the heading or footing. (You can also skip a line using a vertical spot marker, such as </1.)
NEWPAGE
Inserts a new page before the sort footing.


Example: Creating a Sort Footing When a Product Description Changes

This request displays a sort footing each time the product description changes.

TABLE FILE GGPRODS
PRINT PACKAGE_TYPE AND UNIT_PRICE
WHERE UNIT_PRICE GT 50
BY PRODUCT_DESCRIPTION NOPRINT BY PRODUCT_ID 
ON PRODUCT_DESCRIPTION SUBFOOT
"Summary for <PRODUCT_DESCRIPTION" 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

See Including a Field Value in a Heading or Footing for information on embedded field values.



Example: Creating a Conditional Sort Footing With Multiple Sort Options

This report lists orders, order dates, and order totals for the Century Corporation. It uses conditional sort footings to distinguish between orders that total more than $200,000 and less than $200,000.

Notice that one sort phrase (ON ORDER_NUM) specifies several sort-related options (two different SUBFOOT phrases), and that each option has its own WHEN phrase.

TABLE FILE CENTORD
HEADING
"Order Revenue"
" "
SUM ORDER_DATE LINEPRICE AS 'Order,Total:'
BY HIGHEST 5 ORDER_NUM 
ON ORDER_NUM 
   SUBFOOT
      "--- Order total is less than $200,000 ---"
      " "
      WHEN LINEPRICE LT 200000;    
   SUBFOOT
      "+++ Order total is greater than or equal to $200,000 +++"
      " "
      WHEN LINEPRICE GE 200000; 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

The following report appears.



Example: Suppressing a Sort Footing

This request suppresses the sort footing for any product that has only one line of data (that is, a product that was only ordered one time on 01/01/96).

TABLE FILE GGORDER
PRINT QUANTITY
BY PRODUCT_CODE NOPRINT BY PRODUCT_DESCRIPTION
WHERE ORDER_DATE EQ '01/01/96'
WHERE STORE_CODE EQ 'R1019'
WHERE PRODUCT_DESCRIPTION EQ 'Hazelnut' OR 'Biscotti' OR 'Croissant' 
ON PRODUCT_CODE SUBFOOT MULTILINES
"<PRODUCT_DESCRIPTION has multiple orders." 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

In the output, the sort footing for Biscotti is suppressed.



Example: Replacing the Default RECAP Label With a Sort Footing

In this request, a SUBFOOT command for the field DEPARTMENT follows a RECAP command for that field. The RECAP command creates subtotal values for the calculation.

TABLE FILE SHORT
SUM BALANCE AS 'Dollars' ENGLAND_POUND AS 'Sterling'
BY REGION
WHERE REGION EQ 'FAR EAST' OR 'CENTRAL AMERICA' OR 'WESTERN EUROPE';
BY COUNTRY NOPRINT
RECAP EURO/D16=BALANCE * 1.03;
SUBFOOT
" "
"Balance of investments for <COUNTRY> in Euros is <EURO>."
" "
END

The sort footing text (for example, "Balance of investments for FRANCE in Euros is 87,336,971.") replaces the default label for the RECAP value (** EURO 87,336,971).



Example: Omitting a Display Command in a Sort Footing

This request creates a complete report as a sort footing. It does not require a display command because the sort footing content contains the data fields DEPARTMENT and SALARY. By default, the field SALARY is summed in the sort footing.

TABLE FILE EMPLOYEE 
BY DEPARTMENT NOPRINT 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

The output is:



x
Reference: Usage Notes for Subfoots

WebFOCUS