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
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
Impactful Individual
Impactful Individual

sort...icon?

 

what you talking bout willis 

Anonymous
Not applicable

sort icon.. 

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (3,761)