cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Sort Icon connection to Gallery

I am having trouble getting my sort icon to work. I want it to sort my gallery by 'IncidentDate'. This is the formula found in OnSelect: 

SortByColumns(Gallery1.AllItems,"IncidentDate", Descending)

 

It is not giving me an error, however it is not sorting the items either. 

 

This is the function for the gallery items, which works perfectly fine: 

SortByColumns(Filter('Engineer Cost List', StartsWith(IncidentCity, SearchBox.Text)), "IncidentDate", Ascending)

 

any suggestions on how to get this to work? 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@Anonymous 

Set this variable within the OnVisible property of your screen.

 

Set(ascendingOrder,True);

 

Put this code in the OnSelect property of your icon/button.

 

Set(ascendingOrder,If(ascendingOrder=True,False,True))

 

Finally, change your gallery Items property to this

 

SortByColumns(
    Filter(
        'Engineer Cost List',
        StartsWith(IncidentCity, SearchBox.Text)
    ),
    "IncidentDate", 
    If(ascendingOrder=True,Ascending,Descending)
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
cds
Impactful Individual
Impactful Individual

sort...icon?

 

what you talking bout willis 

Anonymous
Not applicable

sort icon.. 

mdevaney
Super User III
Super User III

@Anonymous 

Set this variable within the OnVisible property of your screen.

 

Set(ascendingOrder,True);

 

Put this code in the OnSelect property of your icon/button.

 

Set(ascendingOrder,If(ascendingOrder=True,False,True))

 

Finally, change your gallery Items property to this

 

SortByColumns(
    Filter(
        'Engineer Cost List',
        StartsWith(IncidentCity, SearchBox.Text)
    ),
    "IncidentDate", 
    If(ascendingOrder=True,Ascending,Descending)
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Great Work I can sort in Descending order on  my app

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (81,972)