cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Sort UpDown icon

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Sort UpDown icon

@Sdjackson 

Created needs to be in double quotes.

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

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

Re: Sort UpDown icon

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) 

Highlighted
Helper II
Helper II

Re: Sort UpDown icon

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

 

Highlighted
Super User III
Super User III

Re: Sort UpDown icon

@Sdjackson 

Created needs to be in double quotes.

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

View solution in original post

Highlighted
Helper II
Helper II

Re: Sort UpDown icon

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

Highlighted
Super User III
Super User III

Re: Sort UpDown icon

Brain.gif

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,969)