Oracle9i OLAP Services Developer's Guide to the OLAP DML Release 1 (9.0.1) Part Number A86720-01 |
|
Writing Reports, 11 of 12
When the PAGING option is set to YES, a heading is inserted at the top of each page of output. The PAGEPRG option specifies the text of a command or the name of a program used for generating page headings. By default, the value of the PAGEPRG option is STDHDR, which means that the STDHDR program is used for generating headings.
The STDHDR program, which is provided with the OLAP DML, generates a standard heading. The standard heading consists of the date and time on the left side of the page, and the page number on the right side of the page. One blank line is left after the heading to separate it from the rows of the report.
The STDHDR program uses the values of the TODAY and TOD functions to generate the date and time in the heading. These two functions return the current date and time from the time clock in the user's PC.
The STDHDR program uses the value of the LSIZE option to determine the width of the page, and then uses the width of the page for placing the page number at the right side of the page. By changing the value of LSIZE, you can adjust the position of the page number in the standard header.
If your current outfile is a file, then LSIZE can have different values for the default outfile and the current outfile. Therefore, you should set the LSIZE option after executing your OUTFILE command.
Instead of using the standard heading, you can specify an OLAP DML command or write your own program to produce page headings. Then set the PAGEPRG option to the text of the command or the name of the program.
Suppose you want to include the date and page number on a report but not the time. You can write a program called DATEHDR to produce the headings you want.
DEFINE DATEHDR PROGRAM LD Heading program to create date and page number PROGRAM push dateformat dateformat = '<yy>/<mm>/<dd>' heading w 8 today, sp 0 w lsize-12 r 'Page', sp 0 w 4 - pagenum pop dateformat END
To use the DATEHDR program for your report headings, set the PAGEPRG option in the initialization section of your report program.
push pageprg pageprg = 'datehdr' . . . pop pageprg
Your report will have a heading at the top of each page that displays the date on the left and the page number on the right, as shown in the following illustration.
Instead of replacing the standard heading with your own heading, you might want to use the standard heading and include additional headings of your own as well. For example, you might want to produce the standard heading on each page of the report, a title on the first page, and column headings on each page.
You might want the heading on the first page of the report to look like the one below.
You might want the heading on each successive page of the report to look like the one below.
You can use a program like HEAD.PRG to create the headings.
DEFINE HEAD.PRG PROGRAM LD Produces std header, title, column headings PROGRAM stdhdr if pagenum eq 1 then do heading w lsize c 'Trend of Unit Sales' blank 2 doend heading skip, across month: under '-' c month blank END
For each page, the HEAD.PRG program first executes the STDHDR program to produce the standard heading. Then it tests the value of the PAGENUM option, which holds the page number, and generates the report title on the first page only. Finally, the HEAD.PRG program inserts the column headings on each page.
In your report program, set the PAGEPRG option to HEAD.PRG.
pageprg = 'head.prg'
Tip: Be sure the format attributes in the HEADING command that creates the column headings match the format attributes in the ROW commands for the corresponding data columns in your report program. If the attributes do not match, then the headings will not line up properly with the data columns.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|