How to retrieve list of top 20 objects based of one attribute without using offset?

0
Hello Experts, I have created a list in a microflow and I have added a list of objects in the same list which I have created, finally it contains n number of objects. How do I retrieve only top 20 objects based on certain attribute. NOTE : I can’t able to retrieve from database by using offset and sort because record which I want is not in DB. Answers are really much appreciated!
asked
2 answers
2

Hi Arunkumar,

 

Not really sure about an activity available in this case there is a work around to get 20 records as follows,

Loop the list of objects , create a variable which holds the starting number as 0 and another one for hold total Number. Create a fresh list to hold 20 records out side the loop. Change loop type to while add InitialNumber<=totalNumber. Inside loop add the current iterator object to new list followed by increase the initialnumber by 1 each time.

Your new list will contains 20 records. In future if you want to make as dynamic , make that total number as constant .

Hope this helps!

answered
0

Hi Arunkumar,

Instead of directly adding to a list, you can add that through a loop and have the count =0 and when the iterator increases 

you can increase the count and also you can have a flag[boolean value] for the first 20 records

Hope this might help

answered