36
Views
3
Comments
Data action pagination

Hello,

I have on the "bookingdetailgoed" screen a table called "Beschikbare spullen". This is a data action and I want to add a pagnation to this. However, I am unable to do this. I want it to show 3 rows per page. Is there anyone who can help with this?

Datactionforum.oml
2019-01-31 08-54-57
André Costa
Champion

Hi @Tjors willsmit 


Add this to your query:

ORDER BY @TableSort
OFFSET @StartIndex ROWS
FETCH NEXT @MaxRecords ROWS ONLY; 


You will need to get the count to feed the pagination widget. 

For this, you will have to replicate the same query and simple get the count


I did it in your .oml, kindly check if this solves your problem


Datactionforum.oml
UserImage.jpg
Cvdb

Hi,

Or you can do it all in one query by adding an extra output structure of type integer. Then use the Count(*) OVER() function in your select. This will get a total count over all the records that meet your filter criteria.

Together with OFFSET @StartIndex ROWS FETCH NEXT @MaxRecords  ROWS ONLY  you can only return the number of rows you want per page for your pagination.

So in your query this will be:


It is also explained in more detail here: https://johnalvinsalamat.medium.com/optimizing-paged-sql-queries-in-outsystems-22a13af083ba


2025-04-22 05-54-18
Shashi Kant Shukla

Hi @Tjors willsmit ,

Please add below line in select statement, it will return all count and it can be used for pagination. I have tested and it is working perfectly and in this way there is no need to execute another sql query.

count(1) Over() cnt


Regards

Shashi Kant Shukla

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.