In this section: |
How to: |
Reference: |
By default, the first two lines of a report page are reserved. The first line contains the page number in the top-left corner, and the second line is blank.
Note: The features in this section are not supported for Compound Reports.
You can:
Note: The variables TABPAGENO and TABLASTPAGE cannot be used to define styling with conditional styling (WHEN).
If you enable Section 508 accessibility, a default page number is not included in the HTML table.
Command |
Description |
Applies to |
---|---|---|
<BYLASTPAGE |
Used with REPAGE. Inserts the total page count within the sort group that has the REPAGE option. |
HTML PS PPTX |
REPAGE |
Resets page number to one. |
HTML PS PPTX |
<TABPAGENO |
Inserts the current page number. TABPAGENO suppresses the default page number, and the top two lines of a page are blank. |
HTML PS PPTX |
<TABLASTPAGE |
Inserts the total page count in the report. |
HTML PS PPTX |
SET FOCFIRSTPAGE |
Assigns the designated page number to the first page. |
HTML PS PPTX |
SET PAGE-NUM |
Controls page number display. |
HTML PS |
To add the current page number, add the following to your request.
<TABPAGENO
This request generates a new page whenever the value of the sort field REGION changes. It uses TABPAGENO to insert a page number in the sort footing.
TABLE FILE GGSALES SUM BUDDOLLARS BY REGION BY ST BY CITY ON REGION PAGE-BREAK SUBFOOT "Sales Quota for <REGION Cities" "Page <TABPAGENO" ON TABLE SET ONLINE-FMT PDF END
The first page of output is:
How to: |
Reference: |
You can use the <TABLASTPAGE system variable to insert the total page count into your report. For example, if you wanted to add a footing in your report that said "Page 1 of 5", you could use the <TABLASTPAGE system variable in conjunction with the <TABPAGENO system variable to do so.
To insert the total number of pages, add the following to your request:
<TABLASTPAGE
The following illustrates how to add the current page number and the total page count to a report. The relevant syntax is highlighted in the request.
TABLE FILE EMPLOYEE PRINT EMP_ID AS 'Employee ID' BY SALARY IN-GROUPS-OF 5000 AS 'Salary' BY PCT_INC AS 'Percent,Increase' BY DAT_INC AS 'Date of,Increase' ON SALARY PAGE-BREAK ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ TYPE=TITLE, STYLE=BOLD, SIZE=11, $ ENDSTYLE FOOTING "Page <TABPAGENO of <TABLASTPAGE" END
The first two pages of output are:
How to: |
The <BYLASTPAGE variable used in a heading or footing displays the number of pages of output within each sort group when a report uses the REPAGE option to reset the page numbers for each sort group. This variable can only be used with styled output formats.
If the REPAGE option is not used in the report, the total number of pages in the report (<TABLASTPAGE variable) is used for <BYLASTPAGE.
The request must have the following syntax and hold the output in a styled output format:
BY sortfield REPAGE
The heading or footing can use the following syntax to display “Page x of y”
{HEADING|FOOTING} "Page <TABPAGENO of <BYLASTPAGE"
where:
Is the sort field that has the REPAGE option. A PAGE-BREAK is required on the same sort field or a lower level sort field. PAGE-BREAK starts a new page for each sort break. REPAGE resets the page number to 1 for each sort break.
Is the current page number.
Is the last page number before the repage.
The following request against the GGSALES data source sorts by product, region, category, and city. It resets the pagination each time the product changes. The heading prints the current page number and the total within each product group.
Note that by default, the TABPAGENO and BYLASTPAGE variables have format I5, which leaves a lot of blank space before the page numbers. Therefore, you can use spot markers or COMPUTE commands to move the page numbers to the left.
In the following example, a COMPUTE command creates a field named X that has the value of TABPAGENO but stores it as an I2 field, and the spot marker in the heading moves the BYLASTPAGE page number four spaces to the left. The heading command must come after the COMPUTE command or the field named X will not be recognized:
TABLE FILE GGSALES SUM UNITS COMPUTE X/I2 = TABPAGENO; BY PRODUCT NOPRINT REPAGE BY REGION PAGE-BREAK BY CATEGORY BY CITY HEADING CENTER "<PRODUCT : Page <X of <-4> <BYLASTPAGE " ON TABLE PCHOLD FORMAT PDF END
The following partial output shows that the page number resets to 1 when the product changes and that the BYLASTPAGE variable displays the total number of pages for each product:
How to: |
You can assign a page number to the first page of a report using the FOCFIRSTPAGE parameter. This feature is useful when a report is printed and assembled as part of another one.
You can also control the page numbering of multiple reports in the same procedure using the FOCFIRSTPAGE parameter with the &FOCNEXTPAGE variable.
If TABPAGENO is used, FOCFIRSTPAGE is ignored.
For all report requests in a procedure
SET FOCFIRSTPAGE = {n|1|&FOCNEXTPAGE}
For one report request
ON TABLE SET FOCFIRSTPAGE {n|1|&FOCNEXTPAGE}
where:
Is an integer between 1 and 999999, which is the number assigned to the first page of the report.
Assigns the number 1 to the first page. 1 is the default value.
Is a variable whose value is one more than the last page number of the previous report in a multiple request. The value is calculated at run time.
This request assigns the number 3 to the first page of the report.
SET FOCFIRSTPAGE = 3 TABLE FILE CENTORD HEADING "Sales By Store" SUM LINEPRICE AS 'Sales' BY SNAME ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The report is:
This procedure contains two report requests. The second request sets FOCFIRSTPAGE to the value of &FOCNEXTPAGE.
SET FOCFIRSTPAGE = 3 TABLE FILE CENTORD HEADING "Sales By Store" SUM LINEPRICE AS 'Sales' BY SNAME WHERE SNAME EQ 'eMart' ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END -RUN
SET FOCFIRSTPAGE = &FOCNEXTPAGE TABLE FILE CENTORD HEADING "Sales By Product" SUM LINEPRICE AS 'Sales' BY PRODCAT AS 'Product' WHERE PRODCAT EQ 'VCRs' ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ ENDSTYLE END
The first page of the second report is numbered 4, which is one more than the last page of the previous report:
How to: |
By default, the first two lines of a report page are reserved. The first line displays the page number in the top-left corner, and the second line is blank. To suppress the default display, use the PAGE-NUM parameter.
For all report requests in a procedure
SET PAGE[-NUM] = num_display
For one report request
ON TABLE SET PAGE[-NUM] num_display
where:
Is optional. PAGE and PAGE-NUM are synonymous.
Is one of the following:
ON displays page numbers in the top-left corner, followed by a reserved blank line. ON is the default value.
OFF suppresses default page numbers.
You can use the system variable TABPAGENO.
NOPAGE suppresses default page numbers and makes the top two lines of a page available for your use.
You can use the system variable TABPAGENO.
TOP or NOLEAD removes the line at the top of each page reserved for the page number, and the blank line after it. The first line of a report contains the report or page heading if specified, or column titles if there is no heading.
You can use the system variable TABPAGENO to show page numbers elsewhere in the report.
This request uses SET PAGE-NUM = NOPAGE to suppress default page numbers. It uses the top line of the first page of the report for the report heading.
SET PAGE-NUM = NOPAGE TABLE FILE GGPRODS ON TABLE SUBHEAD "PACKAGING INFORMATION" " " PRINT PACKAGE_TYPE AND SIZE AND UNIT_PRICE BY PRODUCT_DESCRIPTION ON PRODUCT_DESCRIPTION PAGE-BREAK SUBFOOT "PRODUCT ID <PRODUCT_ID" "Page <TABPAGENO " ON TABLE SET ONLINE-FMT PDF END
TABPAGENO inserts the page number in the sort footing. The first page of the report is:
How to: |
You can use the LINES-PER-PAGE StyleSheet attribute in an AHTML report request to set the number of data rows to display on each page in the report output.
To control the number of data rows to display on each page in the report output, use the following StyleSheet syntax:
TYPE=REPORT, LINES-PER-PAGE={n|UNLIMITED},$
where:
Specifies the number of data rows to display on each page. The default value is 57 rows.
Specifies that you want to show all the results on one page.
Note:
ON TABLE SET LINES {n|UNLIMITED}
The following example uses the default WebFOCUS StyleSheet and displays 20 data rows on each page of the report output.
TABLE FILE GGSALES HEADING "Sales Report" SUM UNITS DOLLARS BY CATEGORY BY PRODUCT BY DATE NOPRINT WHERE DATE GE 19960101 AND DATE LE 19960401 ON TABLE PCHOLD FORMAT AHTML ON TABLE SET STYLE * INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$ TYPE=REPORT, GRID=OFF, LINES-PER-PAGE = 20, $ ENDSTYLE END
The following image shows the output for the first page.
The following image shows the output for the second page.