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 Apps / Custom Sort Choice in ...
Power Apps
Unanswered

Custom Sort Choice in Gallery

(0) ShareShare
ReportReport
Posted on by

I am trying to custom sort the approval column in my gallery. I want to sort by , Submitted, Approved, Denied, QuickCheckout.

 

This method works, but does not allow me to custom sort the values. Only Ascending/Descending which is not the right norder

Sort(Filter('Equipment Reservations', 'Reserved By'.Email = currentUser.Email && Returned = 0), Approval.Value, Ascending)

 

I tried this with no luck, I dont really get an error but I dont get any value in the gallery.

Sort(Filter('Equipment Reservations', 'Reserved By'.Email = currentUser.Email && Returned = 0), Approval.Value, [ "Submitted", "Approved", "Submitted", "Denied"])

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Anonymous ,
    Put a numeric field in your list and set it

    1. Submitted,
    2. Approved,
    3. Denied,
    4. QuickCheckout

    on the OnChange of wherever you set the status and then sort by this field.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    Can you try to update the formula to:

    SortByColumns(AddColumns(Filter('Equipment Reservations', 'Reserved By'.Email = currentUser.Email && Returned = 0), "SortColumn",Approval.Value), "SortColumn" , [ "Submitted", "Approved", "Submitted", "Denied"])

     

    Note: You have two submitted values in the order of the formula, please update it according to your required order.

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • Verified answer
    v-yutliu-msft Profile Picture
    on at

    Hi @Anonymous ,

    Do you want to customize the sort order?
    Firstly, for sort function, it only has two sort order: SortOrder.Descending  and SortOrder.Ascending.

    So you could add a column by using If statement with number value then sort based on this new column. Just as @WarrenBelz  said.

    For sortbycolumns function, it could add your sort order: SortOrderTable.

    However, since your Approval field is choice field, so you could not sort based on this column directly. You need to add a column with value of Approval.Value , just as @yashag2255  said.

     

    1)use Sort function:

    Sort( Table, Formula [, SortOrder ] )

    formula:

    Sort(
    AddColumns(
     Filter('Equipment Reservations', 'Reserved By'.Email = currentUser.Email && Returned = 0), 
     "sortorder",
     If(Approval.Value="Submitted",1
     Approval.Value="Approved",2
     Approval.Value="Denied",3
     )//add a number column based on Approval.Value
     ),
    sortorder, //sort based on sortorder column
    Ascending)

     

    2)use SortByColumns function:

     

    SortByColumns( Table, ColumnName, SortOrderTable )

     

    formula:

    SortByColumns(
     AddColumns(
     Filter('Equipment Reservations', 'Reserved By'.Email = currentUser.Email && Returned = 0), 
     "SortColumn",
     Approval.Value
     ), //add a column with value of Approval.Value
     "SortColumn" , //sort based on SortColumn table
    [ "Submitted", "Approved", "Submitted", "Denied"] //sort order table
    )

     

     

     

    Here's a doc about these two functions in details for your reference:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort

     

     

    Best regards,

  • rroque Profile Picture
    350 on at

    @CST

    Hello there. Wonder if you can help me with my problem.   I have a canvas app that I need to sort so what I did was to add buttons with code to sort the list. The sort part works fine but when I scroll the list left to right or right to left the buttons I added will not scroll with the list.  

  • rroque Profile Picture
    350 on at

    Hi Warren,  wonder if you can help me with my problem.   I have a canvas app that I need to sort so what I did was to add buttons with code to sort the list. The sort part works fine but when I scroll the list left to right or right to left the buttons I added will not scroll with the list.  

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard