Skip to content

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

[ad_1]

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":...

[ad_2]

Source link

Leave a Reply