101
Views
4
Comments
Solved
pagination, sorting, search functionality required for data action?

Hi,  i have 2 different entities person, customer ,     i want to combine these 2 and show it in a tablw widget on the screen.so for that 

i created a list of structed there appending values of these to entities in a data action, appending the fields what i wanted(like i want name and email from both entities.

i want to do pagination and sorting, but it seems its not possible with data action, suggest me how do it, or do i need to follow any other approach, and i also want search functionality based on the name or email like both on a match case,(like filter in our aggrigate? suggest me?

2025-04-08 13-09-23
Shubham Shrivastava
Solution

Hi Priya,

Please refer to the below OML to do pagination, sorting and search in data action.

DataActionPagination.oml
2019-01-07 16-04-16
Siya
 
MVP
Solution

First of all the logic you have implemented - getting data using aggregates and then looping each aggregates to final list is not optimised. This can be done is a single SQL query "Select Id, Name, Email from Customer UNION Select Id, Name, Email from Person" and map the Query result to Person Structure ( Id, Name & Email ) and return the output of this SQL as List of Persons. Once you have the Persons at the client side you can do pagination following the article here. I have attached a small video created for another support for your reference.


Screen20Recording202024-04-0520at201.mp4
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Priya,

First of all, it seems very bad for performance to use two seperate queries, and then combine the results in a data action. I would suggest using a single SQL query in the data action, using two SELECTs with a UNION ALL.

Also, do not use a For Each with a single assign and ListAppend. Always use a ListAppendAll + mapping. This is much faster.

As for paging and sorting, I wrote an article (sorry @Sebastian Krempel, going to push mine too :)), which you can find here.

2025-04-08 13-09-23
Shubham Shrivastava
Solution

Hi Priya,

Please refer to the below OML to do pagination, sorting and search in data action.

DataActionPagination.oml
2021-10-04 07-48-45
Sebastian Krempel
Champion

Hi Priya,

I have written a detailed article on how to search, sort and paginate data when using data actions. This also comes with a demo application you can download from the Forge.

Hope this helps.
Regards, Sebastian

2019-01-07 16-04-16
Siya
 
MVP
Solution

First of all the logic you have implemented - getting data using aggregates and then looping each aggregates to final list is not optimised. This can be done is a single SQL query "Select Id, Name, Email from Customer UNION Select Id, Name, Email from Person" and map the Query result to Person Structure ( Id, Name & Email ) and return the output of this SQL as List of Persons. Once you have the Persons at the client side you can do pagination following the article here. I have attached a small video created for another support for your reference.


Screen20Recording202024-04-0520at201.mp4
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Priya,

First of all, it seems very bad for performance to use two seperate queries, and then combine the results in a data action. I would suggest using a single SQL query in the data action, using two SELECTs with a UNION ALL.

Also, do not use a For Each with a single assign and ListAppend. Always use a ListAppendAll + mapping. This is much faster.

As for paging and sorting, I wrote an article (sorry @Sebastian Krempel, going to push mine too :)), which you can find here.

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