Skip to main content

Notifications

Power Automate - General Discussion
Suggested answer

Sort function in Power Automate

Like (1) ShareShare
ReportReport
Posted on 1 Oct 2024 02:35:35 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:
  • Dominik Stalzer | primeone Profile Picture
    Dominik Stalzer | p... 65 on 08 Oct 2024 at 12:52:09
    Sort function in Power Automate
    You are welcome. Please mark the comment as answered 
  • veracruz Profile Picture
    veracruz 45 on 07 Oct 2024 at 01:09:50
    Sort function in Power Automate
    Hi, @Dominik Stalzer | primeone, thank you so much for your help!
  • Suggested answer
    Dominik Stalzer | primeone Profile Picture
    Dominik Stalzer | p... 65 on 03 Oct 2024 at 05:28:35
    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 45 on 03 Oct 2024 at 01:24:36
    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
    Dominik Stalzer | primeone Profile Picture
    Dominik Stalzer | p... 65 on 02 Oct 2024 at 18:13:27
    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 45 on 02 Oct 2024 at 01:12:15
    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
    Dominik Stalzer | primeone Profile Picture
    Dominik Stalzer | p... 65 on 01 Oct 2024 at 05:22:58
    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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,238

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,290

Leaderboard
Loading started