Official Content

Stores the current page number. It is useful when the Procedure object prints information. The page count starts at 1 and GeneXus automatically manages this variable value by adding 1 to it every time the page advances. If another starting value is required, the value of &Page can be changed.

Data Type:
Numeric (6)

Scope

Objects: Procedure

Sample

Consider the following Transaction object:

Customer
{
  CustomerId*
  CustomerName
  CustomerDateOfBirth
  CustomerEmail
  CustomerPhone
}

Suppose you need to implement a PDF report that lists all the customers' names, dates of birth, emails, and phone numbers. 

This listing may have several pages. Therefore, each page must show the current page number and the total number of pages, as follows:

Footer with Page variable and Pages template - Runtime

To do so, follow these steps:

1. Create a Procedure object.

2. Configure the Procedure properties, as shown below:

3. Go to the Rules tab and write:

Output_File("CustomersPDF","PDF");

4. Go to the Layout tab. You will see one predefined Printblock control (named "printBlock1"). Edit the Printblock's Name property and set it to "CustomerInfo".

5. Insert the Customer attributes you want to list inside that Printblock:

CustomerInfo Printblock

6. Create a new Printblock control. To do so, right-click on the "CustomerInfo" Printblock and select Insert Printblock in the contextual menu.

7. Edit the Name property of the newly inserted Printblock and set it to "CurrentPage".

8. In the "CurrentPage" Printblock, insert the &Page variable. Also, insert a Textblock control and edit its Text property to {{Pages}}:

Footer with Page variable and Pages template

9. Finally, in the Procedure Source define the following code:

For each Customer
   Print CustomerInfo   
endfor
Footer
   Print CurrentPage
End

That's all! You can now run the listing and view the &Page variable and {{Pages}} template. 

See Also

Standard Variables List

      

Last update: June 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant