Page Breaking In SQR

The page breaking functionality in SQR is really one of the most useful features in the language. The power of the page breaking functionality (on-break) is that you can break as required while processing rows being returned in a begin-select ... end-select block.

So this means you can simply order the data selected out of the database and page-break as required rather than having to check for complex page break conditions manually using variables to store the last value(s) processed.

The key to the on-break code is the level parameter which is essentially acts a priority (level 1 is the first priority, then level 2, then level 3 and so on).

For example, here's a snippet of code used to break based on three selected columns:

    on-break level=1
    on-break level=2
    on-break level=3
. . .

In this example, it will break in order of level priority, that is first on on a change to CRSE_ID, then on a change to CAMPUS and third on a change to ACAD_GROUP.

Note the procedure call to Print-New-Page() is made using the before keyword which means that the break happens before the next row change in ascending order of break levels. That is, the Print-New-Page procedure will happen before the change in data for a new CRSE_ID, CAMPUS and ACAD_GROUP combination.

No Comments
Back to top