Repeating Headings and Footings on Panels in PDF Report Output

How to:

When the columns presented on PDF reports cannot be displayed on a single page, the pages automatically panel. Paneling places subsequent columns for the same page on overflow pages. These overflow pages are generated until the entire width of the report is presented, after which the next vertical page is generated with a new page number and its associated horizontal panels.

In order to make panels following the initial panel more readable, you can designate that heading elements from the initial panel should be repeated on each subsequent panel using the HEADPANEL=ON StyleSheet attribute.

When paneling occurs, if default page numbering is used, the page number presented will include both the page number and the panel number (for example, 1.1, 1.2, 1.3). Turning HEADPANEL on will also cause the panel designation to be included in TABPAGENO.

HEADPANEL can be designated for the entire report, causing all headings and footings to be replicated on the paneled pages. It can also be turned on for just individual headings, footings, subheadings, or subfootings.

HEADPANEL causes borders from the initial page to be replicated on the paneled pages. Additional control of subheading and subfooting borders can be gained through the use of ALIGN-BORDERS which allows for the designation that subitem borders should align with the body of the data rather than the page or report headings. For more information about using ALIGN-BORDERS with HEADPANEL see Align Subheading and Subfooting Margins With the Report Body.

Syntax: How to Repeat Heading Elements on Panels

TYPE={REPORT|headfoot [BY=sortcolumn]}, HEADPANEL={ON|OFF}, $

where:

REPORT
Repeats all report headings, footings, page headings, page footings, subheadings, and subfootings.
headfoot
Identifies a heading or footing. Select from:
  • TABHEADING, which is a report heading. This appears once at the beginning of the report and is generated by ON TABLE SUBHEAD.
  • TABFOOTING, which is a report footing. This appears once at the end of the report and is generated by ON TABLE SUBFOOT.
  • HEADING, which is a page heading. This appears at the top of every report page and is generated by HEADING.
  • FOOTING, which is a page footing. This appears at the bottom of every report page and is generated by FOOTING.
  • SUBHEAD, which is a sort heading. This appears at the beginning of a vertical (BY) sort group (generated by ON sortfield SUBHEAD).
  • SUBFOOT, which is a sort footing. This appears at the end of a vertical (BY) sort group (generated by ON sortfield SUBFOOT).
BY
When there are several sort headings or sort footings, each associated with a different vertical sort (BY) column, this enables you to identify which sort heading or sort footing you wish to format.

If there are several sort headings or sort footings associated with different vertical sort (BY) columns, and you omit this attribute and value, the formatting will be applied to all of the sort headings or footings.

sortcolumn
Specifies the vertical sort (BY) column associated with one of the report sort headings or sort footings.
ON
Repeats the specified heading or footing elements on each panel.
OFF
Displays heading or footing elements on the first panel only. OFF is the default value.

Note that the HEADPANEL=ON attribute can only be applied to the entire heading or footing, not individual lines or items within the heading or footing.

Example: Repeating All Headings and Footings on Report Panels

The following request against the GGSALES data source sums units sold, budgeted units sold, dollar sales, and budgeted sales by region, state, city, category, and product. The report has a page heading and, for each region, a subfooting.

TABLE FILE GGSALES
HEADING
"PRODUCT SALES REPORT"
""
"Page<TABPAGENO"
""
SUM UNITS BUDUNITS DOLLARS BUDDOLLARS
BY REGION NOPRINT
BY ST BY CATEGORY BY PRODUCT
ON REGION SUBFOOT
" "
" SUBFOOT FOR REGION <REGION "
" SUBTOTAL BUDDOLLARS: <ST.BUDDOLLARS SUBTOTAL DOLLARS: <ST.DOLLARS "
" "
ON TABLE SET BYPANEL ON
ON TABLE SET PAGE ON
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
TYPE = REPORT, HEADPANEL=OFF,$
ENDSTYLE
END

The request sets BYPANEL ON, so each panel displays the sort field values. However, since HEADPANEL=OFF for the entire report, the first panel for page 1 has the heading and the subfooting, but the second panel does not.

The output for page 1 panel 1 has the heading and subfooting, as shown in the following image. Note that with HEADPANEL=OFF, TABPAGENO does not include the panel number.

The output for page 1 panel 2 does not have the heading or subfooting, as shown in the following image.

The following output shows panels 1 and 2 if the StyleSheet declaration is changed to set HEADPANEL=ON for the entire report (TYPE=REPORT, HEADPANEL=ON ,$). The heading and subfooting are repeated on each panel. With HEADPANEL=ON, TABPAGENO includes the panel number.

Example: Repeating a Subfoot on Panels in PDF Report Output

The following request against the GGSALES data source specifies the HEADPANEL=ON attribute only for the subfoot, not for the entire report. Notice that this request uses the default page numbering (ON TABLE SET PAGE ON) rather than TABPAGENO to present the page numbers on each page.

TABLE FILE GGSALES
HEADING
" PRODUCT SALES REPORT" 
" "
SUM UNITS BUDUNITS DOLLARS BUDDOLLARS
BY REGION NOPRINT
BY ST BY CITY  BY CATEGORY BY PRODUCT 
ON REGION SUBFOOT
" "
" SUBFOOT FOR REGION <REGION "
" SUBTOTAL BUDDOLLARS: <ST.BUDDOLLARS SUBTOTAL DOLLARS:  <ST.DOLLARS "
" "
ON TABLE SET BYPANEL ON
ON TABLE SET PAGE ON
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE = SUBFOOT, HEADPANEL=ON,$
 
ENDSTYLE
END

Panel 1 displays both the heading and the subfooting, as shown in the following image.

Panel 2 displays only the subfooting, not the heading, as shown in the following image.

Since the page heading is not repeated, if you use the <TABPAGENO system variable to place the page number in the heading, it will not display the panel number and will not display on the second panel.

TABLE FILE GGSALES
HEADING
" PRODUCT SALES REPORT PAGE <TABPAGENO" 
" "
SUM UNITS BUDUNITS DOLLARS BUDDOLLARS
BY REGION NOPRINT
BY ST BY CITY  BY CATEGORY BY PRODUCT 
ON REGION SUBFOOT
" "
" SUBFOOT FOR REGION <REGION "
" SUBTOTAL BUDDOLLARS: <ST.BUDDOLLARS SUBTOTAL DOLLARS:  <ST.DOLLARS "
" "
ON TABLE SET BYPANEL ON
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
TYPE = SUBFOOT, HEADPANEL=ON,$
 
ENDSTYLE
END

The first panel displays the page number in the heading, without the panel number, as shown in the following image.

The second panel does not display the heading and therefore, does not display the embedded page number, as shown in the following image.

Example: Repeating Styled Headings and Footings on Paneled Pages

The following request against the GGSALES data source has a report heading, a page heading with an image, a footing, a subheading, a subfooting, and a subtotal.

SET BYPANEL=ON
DEFINE FILE GGSALES
SHOWCATPROD/A30 = CATEGORY || ' / ' || PRODUCT;
END
TABLE FILE GGSALES
SUM 
     DOLLARS/I8M AS ''
BY REGION
BY ST
BY CITY
ACROSS SHOWCATPROD AS 'Product Sales'
     
ON REGION SUBHEAD
" "
"Subheading Region <REGION"
" "
ON REGION SUBTOTAL AS '*TOTAL'
ON REGION SUBFOOT WITHIN 
" "
"Subfooting Region <REGION"
" "
ON TABLE SUBHEAD
"Report Heading"
HEADING
"Page <TABPAGENO  "
" "
" "
" "
FOOTING
" "
"PAGE FOOTING "
ON TABLE SUBFOOT
" "
"Report Footing"
ON TABLE SET PAGE-NUM OFF 
-*ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     FONT='ARIAL',
     SIZE=9,
     HEADPANEL=ON,
     BORDER=ON,
$
TYPE=TITLE,
     STYLE=BOLD,
$
TYPE=TABHEADING,
     SIZE=20,
     STYLE=BOLD,
$
TYPE=TABFOOTING,
     SIZE=20,
     STYLE=BOLD,
$
TYPE=HEADING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=HEADING,
     LINE=1,
     JUSTIFY=RIGHT,
$
TYPE=HEADING,
     LINE=2,
     JUSTIFY=RIGHT,
$
TYPE=HEADING,
     LINE=3,
     JUSTIFY=RIGHT,
$
TYPE=HEADING,
     LINE=4,
     JUSTIFY=RIGHT,
$
TYPE=HEADING,
     LINE=5,
     JUSTIFY=RIGHT,
$
TYPE=HEADING,
     IMAGE=smplogo1.gif,
     POSITION=(+0.000000 +0.000000),
$
TYPE=FOOTING,
     SIZE=12,
     STYLE=BOLD,
     JUSTIFY=RIGHT,
$
TYPE=SUBHEAD,
     SIZE=10,
     STYLE=BOLD,
$
TYPE=SUBFOOT,
     SIZE=10,
     STYLE=BOLD,
$
TYPE=SUBTOTAL,
     BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
     SIZE=9,
     WRAP=ON,
$
TYPE=ACROSSTITLE,
     STYLE=BOLD,
$
TYPE=GRANDTOTAL,
     BACKCOLOR=RGB(210 210 210),
     STYLE=BOLD,
$
ENDSTYLE
END

Since HEADPANEL=ON for the entire report, both panels display all of the heading and footing elements.

The following image shows page 1 panel 1.

The following image shows page 1 panel 2.