Oracle9i OLAP Services Developer's Guide to the OLAP DML Release 1 (9.0.1) Part Number A86720-01 |
|
Writing Reports, 10 of 12
You can use a number of options to produce report output in separate pages and control the format of the pages.
The paging facility is controlled by the PAGING option. When you want to produce your report in separate pages, set the PAGING option to YES in the initialization section of your report program. When PAGING is set to YES:
The paging options are summarized in the following table.
When a new page is used to store data, LINENUM is set to 1 and PAGENUM is incremented. However, the first line of output is produced after the number of lines used by TMARGIN and the lines produced by the PAGEPRG program. By the second line of actual output, LINENUM is set to the actual line number on the page.
For example, if you are using the default page layout, and you show the value of LINENUM on the first line of the body of the page, then its value is 1. However, if you show LINENUM on the second line, then its value is 6 because the 2 lines for TMARGIN and the 2 lines produced by STDHDR have been added to the line count.
If the PAGING option is set to YES, then you can use the PAGE command to force a page break in a report. For example, you might want to start each section of data on a new page of the report.
For example, if your report shows regional sales data for each product, then you can start the data for each product on a separate page. Your report program might include the following lines.
for product do page row under '-' valonly product for region row indent 3 region, across month: units doend
The PAGE command forces a new page at the beginning of the FOR loop for each value of the PRODUCT dimension.
Suppose you want to restart the page numbering of your report at 1 for each new product. You can use the following code to reset the PAGENUM option to 0 before executing a PAGE command.
for product do pagenum = 0 page row under '-' valonly product for region row indent 3 region, across month: units doend
Your decision to start a new page might depend on the space available on the current page. For example, you might want to start a block of data on a new page when there is not enough room on the current page for the entire block.
To start a new page when fewer than a specific number of lines remain on the current page, test the value in the LINESLEFT option.
For example, to start a new page when fewer than 12 lines are left on the current page, use these commands in your program.
if linesleft lt 12 then page
You can use the OUTFILE command to specify a file as the target outfile or to direct output to the default outfile.
The following command sends output to a file named repfile.txt
.
outfile 'repfile.txt'
The following command redirects output to the default outfile.
outfile eof
Unless you use the OUTFILE command to send output to a file, your default outfile is used.
The paging options can have different values for the default outfile and for a different file. When you use the OUTFILE command to direct output to a file, the values of the paging options that are currently in use for the default outfile are saved automatically, and reinstates them when you redirect output back to the default outfile.
When you direct output to a file, the paging options are reset automatically to their default values for output to the file. After executing the OUTFILE command, you can set the paging options as desired for the file. However, the values of the paging options for the file remain in effect only as long as you continue sending output to the same file. If you use another OUTFILE command to direct output to a different outfile, then the current values for the file are not saved.
Therefore, if you want the paging options to have a particular value for a particular file, then you must set the options each time you use the OUTFILE command for that file. This is true even when you are appending output to an existing file.
The value of the PAGENUM option is reset to 1 when you execute an OUTFILE command to send output to a file. However, if you redirect output to the default outfile, then PAGENUM will contain the value it last held for the default outfile. To be sure your report starts with Page 1, you should set PAGENUM to 1 in the initialization section of your report program.
You can make your program pause while producing report output when the PAGING option is set to YES in your Express session.
The following table shows how to pause during the execution of a report program.
IF you want your program to pause . . . | THEN . . . |
---|---|
after producing each page of output, |
set the PAGEPAUSE option to YES. |
at other times during the execution of the program, |
use the PAUSE command. |
When a pause occurs as a result of the PAGEPAUSE option or the PAUSE command, program execution is suspended, and a message is displayed in the prompt area at the bottom of the screen. The default message is as follows.
Press <Enter> to continue.
Execution of commands continues when the user presses a key.
You can replace the default pause message with a message of your own, as shown in the following table.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|