New Sorting actions for arrays/tables In Power Automate: sort & reverse


Until recently it was not possible to easily sort arrays or collections of objects in Power Automate using a single expression, either complex logic techniques or Office Scripts were required.

But recently two new handy expressions became available in Power Automate that make it really simple to do:

  • sort
  • reverse

How the sort expression work

The sort expression accepts either an array with simple values or a collection of objects.

If you pass a simple array to the expression, no parameter is needed. For example, if you have the following array variable with people’s names:

[
"Michel",
"Nick",
"Michael",
"Carlos",
"Renan"
]

By using the sort expression as below:

sort(variables('Names'))

You will get as output:

[
  "Carlos",
  "Michael",
  "Michel",
  "Nick",
  "Renan"
]

If you have an array/collection with objects, you need to specify a property to use in the sorting, so for example, consider an array variable named ‘NamesCountries’ as below:


Source link

More About This Author

michelcarlo
michelcarlo
SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff).

Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.

Author: michelcarlo

SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff). Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.

Share This Post On
Share via
Copy link
Powered by Social Snap