Using LastPage() and TotalPages$() functions

Hello,
I need to display on the page before last some text and on the last page - grid with some images. I tried to use LastPage() function and ToNumber(TotalPages$())-1 for this, but none functions work correctly. I tested these functions - ToNumber(TotalPages$()) returns always 0, and LastPage() returns always false.
image
I tested a lot and understand, that only Page() function works for me. But it is not enough to understand what page is last on the report.
How I can resolve my task? Any help would be appreciated.

You need a crystal ball to do things like that. We have one - Automated Multi-Pass Printing | Reporting Blog List & Label

I learnt your proposal, but I don’t have an idea how I can use Page Reference or print index for my task.
I need to display grid of images on the last page and some text on the previous page. My idea is to use “Appearance Condition” property like bellow.
image
But it doesn’t work. Could you describe your idea more detailed, please?

You place a text object on the LastPage() and use SetVar("LastPage", Page()). Now switch to two passes and use Page() = GetVar("LastPage") - 1 for your condition. It should be filled with the correct data in the second pass then. If this still is unclear, I’m happy to upload a sample tomorrow, I’m just on my mobile currently.

If I understand correctly, I should use first text object to set in the field “LastPage” value of current page and also I should set “Appearance condition” to result LastPage() function.


And then I can use this “LastPage” field in “Appearance condition” for others objects (images, texts etc.).

But LastPage() function doesn’t work for me, unfortunately. I mentioned it in the first message. This function returns false.
Working example will be great for me.
Thank you

You might run into this issue :slight_smile:

However, no worries, I’ll follow up with a sample tomorrow.

1 Like

Here you are - attached is a “Simple List” report for the demo application. It has this object in its structure:

image

The content is simply

SetVar("LastPage", Page(), False)

Mult-Pass processing is enabled for the project and only the last pass is actually printed:

image

I’ve also added a text object that makes use of this:

image

Its appearance condition reads

Page() = GetVar("LastPage")-1

Which works just as it should:

Hope this helps for your scenario as well.

MultiPassSample.rpt (75.9 KB)

1 Like