Skip to main content

Notifications

Power Automate - General Discussion
Suggested answer

Sort function in Power Automate

Posted on by 35
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:
  • Suggested answer
    Sort function in Power Automate

    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
    veracruz 35 on at
    Sort function in Power Automate
    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
    Sort function in Power Automate
    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
    veracruz 35 on at
    Sort function in Power Automate
    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
    Sort function in Power Automate
    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'])
     

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 141,157

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,414

Leaderboard

Featured topics