Kbase 18077: 4GL report with " PAGE <n> OF <n> " for page number
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  07/07/1998 |
|
4GL report with " PAGE <n> OF <n> " for page number
It is possible to create 4GL reports with relative page numbering,
although the solution is not direct and requires running the report
twice.
One limitation of PROGRESS reports is that the formatting of the
data is done at the same time as the data is accessed from the
database. As a result, it is not possible for the 4GL to "look
ahead" and determine what the total number of pages of generated
output will be. This is essential data for a header of type
"PAGE <n> OF <n>". (Report Builder has this same limitation. Actuate
has a "look-ahead" function which allows it to create reports in this
manner.)
The trick to doing this in the 4GL is to generate the target report
two times: once to find out the total number of pages to be
generated, then the second time to use that information in the
"PAGE <n> OF <n>" header. The first report should be discarded.
In the example below, the report is first output to a file. The
total number of pages is captured in a variable, which is then used
when the report is run a second time to make the proper page number
header. The file created by the first run of the report is deleted.
The report itself is crude but demonstrates the concepts.
/* BEGIN EXAMPLE */
output to junk.txt page-size 20.
def var rel-page as int.
for each state break by state with frame a-frame:
form header "Customers in" at 1
state.state-name "Page" at 25
page-number format ">9" at 32
"of" rel-page with page-top frame pg-top-1.
view frame pg-top-1.
for each customer where customer.state = state.state with
frame detail-1:
display customer.cust-num customer.name customer.state.
down.
end.
rel-page = page-number.
page.
end.
os-delete junk.txt.
output to terminal page-size 20.
for each state break by state with frame c-frame:
form header "Customers in" at 1
state.state-name "Page" at 25
page-number format ">9" at 32
"of" rel-page with page-top frame pg-top-2.
view frame pg-top-2.
for each customer where customer.state = state.state with
frame detail-2:
display customer.cust-num customer.name customer.state.
down.
end.
page.
end.