Sort an object array by numeric values that are stored as string using Power Automate


Recently I got a question in a previous post about the sort expression in Power Automate:

I am attempting to use this expression in a compose box to sort by a numeric ascending value, but it is sorting that value as if it were a word and not a number. How would I amend this expression to sort the array by a number value that is apparently stored as a text string?

Let’s have a look at the issue. If we have an array of objects as the below one in a compose action to be simple, with a integer value as String (number property):

[
  {
    "firstName": "Sylvester",
    "lastName": "Mavros",
    "country": "Sudan",
    "number": "1"
  },
  {
    "firstName": "Reed",
    "lastName": "Dunne",
    "country": "Cape Verde",
    "number": "10"
  },
  {
    "firstName": "Gabriel",
    "lastName": "Balenzuela",
    "country": "Hong Kong",
    "number": "4"
  },
  {
    "firstName": "Kory",
    "lastName": "Melot",
    "country": "Azerbaijan",
    "number": "30"
  },
  {
    "firstName":...

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