Inserting a Page Break

In this section:

How to:

Reference:

Use the PAGE-BREAK command to generate a new page each time the value of a specified vertical sort (BY) field changes. This helps to prevent related information from being presented over multiple pages. When you use a page break, column titles and any page headings appear at the top of each new page. When the request has a PAGE-BREAK, the GRANDTOTAL is on a page by itself.

PAGE-BREAK does not apply when report output is stored in a HOLD, SAVE, or SAVB file.

In an HTML report, PAGE-BREAK creates a new section of the report, with column titles and an incremented page number, on the same webpage. It does not, by itself, create a new webpage. To create multiple webpages in an HTML report:


Top of page

x
Reference: Page Break Commands

Command

Description

Applies to

PAGE-BREAK

Generates new page.

HTML

PDF

PS

NOSPLIT

Prevents undesirable page break.

PDF

PS

SET LINES

Synchronizes report page with browser page.

HTML



x
Reference: Working With Multi-Table HTML Reports

Top of page

x
Syntax: How to Insert a Page Break
{ON|BY} fieldname PAGE-BREAK [REPAGE] [WHEN expression;]

where:

ON|BY

Is a vertical sort phrase. The terms are synonymous.

fieldname

Is the sort field on which the page break occurs. Specify the lowest level sort field at which the page break occurs. A page break occurs automatically whenever a higher level sort field changes.

REPAGE

Resets the page number to 1 at each page break or, if combined with WHEN, whenever the WHEN criteria are met.

WHEN expression

Specifies a conditional page break in the printing of a report as determined by a logical expression. See Controlling Report Formatting for details.



Example: Inserting a Page Break

This request generates a new page whenever the value of the sort field SALARY changes.

TABLE FILE EMPLOYEE
PRINT EMP_ID
BY SALARY IN-GROUPS-OF 5000
BY PCT_INC BY DAT_INC 
ON SALARY PAGE-BREAK 
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET PAGE-NUM OFF
END

The first two pages of the report are displayed to illustrate where the page breaks occur:

The second page is:



Example: Displaying a Multiple-Table HTML Report

In this request, each page is returned to the browser as a separate HTML table. SQUEEZE is set to OFF for consistent alignment of tables across pages.

SET STYLEMODE = PAGED 
SET LINES = 12
TABLE FILE CENTORD
HEADING
"SALES OVER $200,000"
PRINT LINEPRICE AS 'Sales'
BY SNAME BY ORDER_NUM
WHERE LINEPRICE GT 200000
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, SQUEEZE=OFF, $
ENDSTYLE
END

Two pages of the report follow, showing consistent alignment:

The same two pages illustrate inconsistent alignment with SQUEEZE set to ON:


Top of page

x
Preventing an Undesirable Split

How to:

A page break may occur in the middle of information logically grouped by a sort field, causing one or more group-related lines to appear by themselves on the next page or in the next window. Use the NOSPLIT option to avoid this kind of break. When the value of the sort field changes, the total number of lines related to the new value appear on a new page, including sort headings, sort footings, and subtotals if applicable.

This feature applies to a PDF or PS report.

If you use NOSPLIT with PAGE-BREAK, the PAGE-BREAK must apply to a higher-level sort field. Otherwise, NOSPLIT is ignored. NOSPLIT is also ignored when report output is stored in a HOLD, SAVE, or SAVB file. NOSPLIT is not compatible with the TABLEF command and generates an error message.



x
Syntax: How to Prevent an Undesirable Split

This syntax applies to a PDF or PS report. Use only one NOSPLIT per report request.

{ON|BY} fieldname NOSPLIT

where:

ON|BY

Is a vertical sort phrase. The terms are synonymous.

fieldname

Is the name of the sort field for which sort groups are kept together on the same page.



Example: Preventing an Undesirable Split

This request uses NOSPLIT to keep related information on the same page:

SET ONLINE-FMT = PDF
TABLE FILE EMPLOYEE
PRINT DED_CODE AND DED_AMT
BY PAY_DATE BY LAST_NAME 
ON LAST_NAME NOSPLIT 
END

When the value of LAST_NAME changes from STEVENS to CROSS, the lines related to CROSS do not fit on the current page. With NOSPLIT, they appear on the next page:

Without NOSPLIT, the information for CROSS falls on the first and second pages:


WebFOCUS