Skip to Content

See also: Paging records in the UI

Paging through a list of records using a Form element is quite convenient in some cases. For example where there are too many fields to be presented as table columns. A simple application may look like this:

/wp-content/uploads/2013/04/run_time_200618.png

We will now build a simple application that enables such behavior.

1.      Consume the function returning the list of records, in this case a BI Service:

1.PNG

2.      Add a Data Share element to the model and connect it to the output port of the service.

3.      Add a new field called order to the Data Share to define the numbering of each record. As the user uses the application we update this number for each record (1, 2, 3…) so we could later find it.

/wp-content/uploads/2013/04/edit_data_share_200622.png

4.      Connect a Form View element to the Data Share.

2.PNG

5.      Add a Data Store element to the model, and define two Fields: max for the number of the last record, current_index for the current record presented in the Form View. This field should update as the user moves through the records (1, 2, 3…).

3.PNG

6.      Connect an Aggregate Operator to count the number of records.

4.PNG

7.      Connect the Operator to the Data Store and define the Fields mapping:

5.PNG

8.      Go to the Layout Board, define a toolbar for the Form View, and add two buttons for the Next and Previous operations (you could change the button text as follows).

6.PNG

9.      Define the Action for the Next button. First give the current index to the current record:

/wp-content/uploads/2013/04/7_200628.png

Then assign an incremented value to the current index:

/wp-content/uploads/2013/04/8_200629.png

Finally use the FIND Action to get to the next record:

/wp-content/uploads/2013/04/9_200630.png

Note that if we have only one button with the FIND Action only, we get a cyclic traversal of the records.

10.   Define Action for the Previous button. First assign a decremented value to the current index:

/wp-content/uploads/2013/04/10_200631.png

Then use the FIND action to get the record where the order is the same as the changed current index:

/wp-content/uploads/2013/04/11_200632.png

11.   Define Enable condition for the previous button: prevent trying to get records with order lower than 1:

/wp-content/uploads/2013/04/12_200636.png

12.   For the Next button define in the same manner, don’t allow to pass the maximum order number:

=store@current_index<store@max

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply