After fetching a list of items be able to sort the returned items before you use an Apply to Each.
You can filter an array.... Sort is the next obvious requirement.
This is so frustrating. Sorting an array was built-in Nintex back in 2007! I have a large and complex query that I need to sort, but cannot find an action that sorts the array or even an expression... 😞
I found this manual for sorting an array:
But.... it should be a built-in function in flows.
There is also another blog post as a work around https://sharepains.com/2020/03/05/sort-an-array-in-power-automate/
We need a Sort Array and a Deduplicate Array actions ASAP...
@testasdfasfsafa Deduplicating arrays can be done in one action using intersection(). An intersection of the array with itself will give you a deduped version. This may or may not help your scenario, since it is only one action, it seems covered already, albeit not an obvious solution.
Deduplicating is not sorting. Maybe I want my duplicates and them sorted.
Is there still no built in action or function to sort an array?
I'm afraid no one is working on Power Automate or managing these forums... Important and foundational items have been stale for years making this forums a digital cemetery for good ideas and feedback. It's clear Microsoft has moved on and not letting us, the pioneers, know what is going on.
I have also written up a method to do this, which is completely different from the loop based methods suggested by others. It is very easy to do, executes fast and you can implement very quickly:
How to sort an array in Power Automate
Be interested to hear how you get on.
If I answered your question, please accept it as a solution 😘