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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Sort UpDown icon

(0) ShareShare
ReportReport
Posted on by 97

Hi, I am struggling to get the Sort icon within the Browse Screen to work. On Start for the PowerApp I have set a variable as the user email and then have a function in the Gallery which means the user can only display their own entries:  Filter('Purchase Order', CreatorEmail = varUser.Email).  This was necessary since the entries staff are making are for sickness/absence and are sensitive.

I can't then get the Sort UpDown to work as this isn't doing anything.  Currently it's OnSelect is: UpdateContext({SortDescending1: !SortDescending1})

I would like to sort based on 'Created' which is an entry in the SharePoint List but don't know what language to use.  Can anyone help me?

Stuart

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Sdjackson 

    You need to wrap your filter with a SortByColumns() and replace the column you wish to sort by in double quotes where I have "SortingColumn"

     

    SortByColumns(Filter('Purchase Order', CreatorEmail = varUser.Email),"SortingColumn", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

     

    To reverse the starting sort order in the toggle, put this formula in the Items property of the gallery.

    SortByColumns(Filter('Purchase Order', CreatorEmail = varUser.Email),"SortingColumn", If(SortDescending1, SortOrder.Ascending, SortOrder.Descending))

     To explain how this works, the double arrow Icon creates a context variable called SortDescending1 (although it could be anything).  

    UpdateContext({SortDescending1: !SortDescending1})

    The toggle effect is produced by using var:!var, it is in effect saying if the variable is currently var, then make it the opposite ie.  Not(var) 

  • Sdjackson Profile Picture
    97 on at

    Thank you for replying. You've certainly helped my understanding (thank you) but I'm not quite there. I changed the Browse Gallery Items to be SortByColumns(Filter('Purchase Order', CreatorEmail = varUser.Email), Created, If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

    Created is the date time stamp for each entry.

    But, when I do that the Gallery view becomes blank and I get the following error:

    Sdjackson_0-1597161457872.png

     

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Sdjackson 

    Created needs to be in double quotes.

    SortByColumns(Filter('Purchase Order', CreatorEmail = varUser.Email), "Created", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
  • Sdjackson Profile Picture
    97 on at

    You're a genius. Thank you, I've learned and fixed the issue thanks to you.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Brain.gif

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard