Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

AbsolutePageCount And AbsolutePageNo

edited September 2011 in RAP
I have a variable in the Footer Of my report called variable 1. The
Report is 3 pages long when previewed.

In the OnPrint Event Handler I have the following Code:

ShowMessage('Page ' + IntToStr(Report.Page.AbsolutePageNo) + ' of ' +
IntToStr(Report.Page.AbsolutePageCount));
if (Report.Page.AbsolutePageNo < Report.Page.AbsolutePageCount) then
Variable1.Value := 'Next'
else
Variable1.Value := 'END';


The idea here is to make "END" only show up on the last page while next
appears on the first two.

When I preview the report I see "END" on the first page and the Message
Box says Page 1 of 1.

When I click next page in the previewer I see "END" on the 2nd page and
the Message Box says Page 2 of 2.

When I click next page again in the previewer I see "END" on the 3rd
page and the Message Box says Page 3 of 3.

Since there are no more pages I click previous and see "Next" on the
second page and The Message says Page 2 of 3.

It's almost as if the report doesn't know how many pages there are until
it has finished printing/previewing and only then can display the
correct values on the correct page.

Is this a bug, or am I using the wrong event handler?

Comments

  • edited September 2011
    Hi Nigel,


    This is correct. In order for the report to know how many pages it has
    before printing, it needs to be a two pass report. If you set the
    Report.PassSetting to psTwoPass, you should get the correct values.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2011
    Yep, that worked.

    Thanks.

This discussion has been closed.