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?
Hi Priya,
Please refer to the below OML to do pagination, sorting and search in data action.
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.
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.
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