cancel
Showing results for 
Search instead for 
Did you mean: 

Sort Array

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.

 

 

Status: New
Comments
asdfaf4
Kudo Collector

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... 😞

max81
Kudo Kingpin

I found this manual for sorting an array:

http://johnliu.net/blog/2018/12/how-to-implement-sort-with-microsoft-flow-in-3-actions-within-a-loop 

 

 

But.... it should be a built-in function in flows. 

LauraGB
Kudo Collector

There is also another blog post as a work around https://sharepains.com/2020/03/05/sort-an-array-in-power-automate/

testasdfasfsafa
Advocate III

We need a Sort Array and a Deduplicate Array actions ASAP...

gw_spoke
Regular Visitor

@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.

LauraGB
Kudo Collector

Deduplicating is not sorting. Maybe I want my duplicates and them sorted.

ThommyP
Regular Visitor

Is there still no built in action or function to sort an array?

testasdfasfsafa
Advocate III

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.

Paulie78
Super User III

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.

 

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘