When crafting reports in Jedox, it’s not uncommon to encounter scenarios where the large volume of rows becomes unwieldy. In such cases, the implementation of paging proves invaluable. Paging not only ensures a clear presentation of the table but also serves to optimize server resources during report access.

In the example provided below, we illustrate a two-step approach to introduce a paging solution, leveraging the Jedox BikerBest database.

Step 1: Create the Table of Elements

The table, presented via Dyna-range, reveals an extensive list of elements that stretches to the bottom, posing navigation challenges. To address this, a subset of Dyna-range is strategically employed to showcase all base elements within the ‘Product’ dimension.

paging step 1

Step 2: Limit the number of rows based on the variables and introduce paging

It’s common practice to incorporate external variables into the subset.

StartPosition – > from which element we want to start [Inital 0].

NumberOfElements -> how many elements we want to see in the table [editable but set on 30 for example].

MaxElements->count of all elements in the subset [useing subsetsize formula].

Pages-> number of max pages [=MaxElements/NumberOfElements+1].

CurrentPage->show current page comparing to max pages [=IF(StartPosition=0,1, StartPosition /NumberOfElements+1)].

subset paging
paging step 2

While clicking on the buttons LEFT or RIGHT, the macro function is triggering the code.

For left <<:

function _cmbLeft_Click ()
{
$StartPosition= activesheet()->range(‘M2’);
$NumberOfElements = activesheet()->range(‘M3’)->value;
$calculation = $StartPosition->value – $NumberOfElements;
if ($calculation<0) { $newVal = 0; } else { $newVal = $calculation; } $StartPosition->value=$newVal;}

For right >>:

function _cmbRight_Click ()
{
$StartPosition= activesheet()->range(‘M2’);
$NumberOfElements = activesheet()->range(‘M3’)->value;
$MaxElements = activesheet()->range(‘M4’)->value;
$calculation = $StartPosition->value + $NumberOfElements;

if ($calculation>$MaxElements) {
$newVal =$MaxElements;
} else {
$newVal = $calculation;
}
$StartPosition->value=$newVal;
}

The whole project can be found here.

More about Jedox macros read here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!