How to configure the number of pages of the paginationBar, when the grid is loaded with variables

 

When working with variables, when loading data into the grid, it may turn out that the PaginationBar shows only one page, preventing all records from being seen in the grid, as we see in the following image:

 

Pagination1

 

This is due to the different ways that can be used to load variables, which also depend on navigation and filters.

 

Instructions to have a correct paging:

 

To show the correct number of pages, the variable &GridPageCount of the paginationbar must be loaded manually with the number of pages that should exist.

GridPagecount

 

You can load this variable from the refresh event as I show below:

refresh RecordCount

&RecordCount = Grid.RecordCount 
&GridPageCount = &RecordCount/Grid.Rows + iif(Mod( &RecordCount, Grid.Rows)>0,1,0)

 

This is an example of how it can be loaded, where we use an auxiliary variable(&RecordCount) to count the number of records, and based on them, calculate the number of pages for the pagination bar.

The count of the total records will depend on how the variables are being loaded, so the logic may vary, the important thing is to set the total records of the grid in the variable &RecordCount.