Straight Table Pagination
Straight tables are one of the most commonly used objects in Qlik. I would say there are no reports without tables. Even if we try to avoid them, they are always there.
Tables don’t usually present a problem in our reports. However, when we work with big amount of data, tables don’t perform well and we need to start applying filters to make them smaller. No matter how big and dirty tables can get, users still want all of the detailed data in a table. No filters, no shortcuts. All of it.
This presents a big problem from the performance point of view. None of the objects in Qlik allow pagination. This means, that the whole table will be calculated at run time when it’s visible.
Pagination techniques allow applications to load part of the data at a time instead of all of it. When user selects a different page in the table, only the data belonging to the page is displayed and the rest is disregarded.
Pagination in Qlikview can’t be done out of the box. Instead we need to use different technics at design time or make changes in our script to add pagination at the table level. We could also use extension objects.
The solution I’m presenting today is done completely at design time so our script remains untouched.
We only need 3 variables. For this example I used:
- vPaginationLines: number of lines we want to display per page.
- vPagination: configuration variable to make the pagination work.
- vDimensions: used to calculate total number of rows.
Variables can be created from within the script or from the Variable Overview menu. vDimensions should have the dimensions used in the table separated by “&”. If I’m displaying Sales by Country and Department, then my vDimensions variable would look like Country&Deparment.
In the table expression, I used the following if statement:
if( rowno(Total) >= $(vPagination) – $(vPaginationLines)+1 And RowNo(Total) <= $(vPagination), tableExpression))
Please feel free to download the Sample Application here.