web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sort function in Power...
Power Automate
Suggested Answer

Sort function in Power Automate

(1) ShareShare
ReportReport
Posted on by 45
Hello, I'm new to Power Automate and I want to ask about how to sort HTML table.
 
I'm still confused with how to use sort function in Power Automate. My data is string and this is a bit of my flow. Where should I put sort function in this flow?
 
 
I tried to sort it inside Create HTML, but the data type is different.
 
 
 
I want to sort my data ascendingly. Can anyone help with this? Thank you in advance!
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Dominik Stalzer | primeone Profile Picture
    71 on at
    Add "Initialize variable" action, where you can store your data as an array.
     
    Use the "Compose" action to apply the sorting function on the array. For example:
    sort(variables('YourArray'))
     
    If you're sorting by a specific property within an object, use a lambda expression like this:
    sort(variables('YourArray'), item()?['Delay'])
     
  • veracruz Profile Picture
    45 on at
    Hi @Dominik Stalzer | primeone, thank you for your respond.
     
    I want to ask again, in my flow, I need to filter all the data several times first before sorting them all based on the Delay column and then show them on the email. If I initialized the Delay table first, how can I filter the Delay array? When should I sort it?
  • Suggested answer
    Dominik Stalzer | primeone Profile Picture
    71 on at
    Hi.

    Before sorting, you need to gather and filter your data. Since you mentioned that you need to filter several times before sorting, use the Filter Array action to get the subset of data that you want. This step should occur before sorting.
    Then initialize the Delay Array.
    If your flow involves initializing an array for the "Delay" column, you can use Initialize Variable and set the type as an array. After filtering, you will store the filtered data into this array.

    Kind regards.
  • veracruz Profile Picture
    45 on at
    Hi @Dominik Stalzer | primeone, sorry to ask again.
     
    I have tried to add Initialize Variable after I filtered my data but because the steps are inside Y/N Condition, it caused this error. Is there any other way?
     
  • Suggested answer
    Dominik Stalzer | primeone Profile Picture
    71 on at

    The "Initialize Variable" of the variable belongs right at the beginning, near the trigger. Just let the Value field be empty. After that, you can set your array as described using "Set Variable" in your Y/N Condition. I didn't realize that wasn't clear

  • veracruz Profile Picture
    45 on at
    Hi, @Dominik Stalzer | primeone, thank you so much for your help!
  • Dominik Stalzer | primeone Profile Picture
    71 on at
    You are welcome. Please mark the comment as answered 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard