Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Sort Gallery

(0) ShareShare
ReportReport
Posted on by 125

Hello Folks,

 

I have a column that have multiple status and I need to sort them not alphabetical

 

here's the current sort

 

Returned

Open

In Progress

Fulfilled

 

the requirements it should sort

 

In Progress

Returned

Open

Fulfilled

  • Verified answer
    Re: Sort Gallery

    You can filter the collection prior to sorting it. See the modified code below for an example:

    SortByColumns(
     Filter(myItems, EndsWith(Name, "2")),
     "Status",
     ["In Progress", "Returned", "Open", "Fulfilled"])

    Hope this helps! 

  • philifova Profile Picture
    philifova 125 on at
    Re: Sort Gallery

    Hello @CarlosFigueira 

     

    How can I combine this with filter?

  • Verified answer
    Re: Sort Gallery

    You can pass a "sort order table" to the SortByColumns function, and that will determine how the items are sorted. For example, if you have a collection defined as

    ClearCollect(
     myItems,
     { Name: "Item 1", Status: "Returned" },
     { Name: "Item 2", Status: "Open" },
     { Name: "Item 3", Status: "Returned" },
     { Name: "Item 4", Status: "In Progress" },
     { Name: "Item 5", Status: "Fulfilled" },
     { Name: "Item 6", Status: "Open" },
     { Name: "Item 7", Status: "Returned" },
     { Name: "Item 8", Status: "In Progress" });

    Then the following expression will sort the items according to your requirement:

    SortByColumns(
     myItems,
     "Status",
     ["In Progress", "Returned", "Open", "Fulfilled"])

    See the screenshot below for an example of a gallery with this expression:

    ForumPost001.png

    Hope this helps!

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard