[PAGE#] - wrong value

Hello

I have a "little" problem with [PAGE#] variable. If someone can help me ...

I made a report for some articles with a table of contents at the end. TOC is simple and contain article code and the page that this article is printed.
I have 2 pages: "Page1" - main report page and "Page2" - TOC page and my report is "Two pass report". Also, I have 2 variables in "Data dictionary": "i" - variable for counting (initial i = 0) and "Pages" - an array to store page numbers.

I have the following code:

Page1 (main page), OBP of MasterData band:
begin
if [FINALPASS] then
begin
i := i + 1;
Pagesi := [PAGE#]
end
end

Page2 (TOC page), OBP of Page2 (set i = 0):
begin
i := 0;
end

Page 2 (TOC page), OBP of MasterData band:
begin
if [FINALPASS] then
i := i + 1
end

Report is working fine with a single "exception": every article that is listed on top of page, in TOC appear to be listed on previous page :-(

Is this a bug of [PAGE#] variable when this variable is used in OPB event or I do something wrong?!?


Thanks in advance.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 1:49AM
    IMHO as a user
    once you start manipulating page production through code or in a final pass you can't depend on the Page# or totalPages variable you must use your own vars
    for both, and increment or decrement accordingly, and finding the right place and event to do it can sometimes be very tricky particularly if a report causes a newpage to be formed in the final pass that did not exist in the first pass.
    Also I prefer not to use array names that are properties of fr.
    ie Page[], Pages[]
    regards ;)



Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.