cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bmurphy1
Level: Powered On

Adding an Additional Sort/Filter Button

I'm connecting the power app to a sharepoint list.  The app is set up to sort by Title which is then set to descending and ascending.

 

I'd like to add another sort button (or feature) that will enable to user to sort by ID.

 

The Browse Screen

OnVisible - ClearCollect(CollMyItems, Filter('Rep 1 Test', 'Created By'.DisplayName=_CurrentUser, User().FullName))

 

The Gallery

Items - SortByColumns(Filter(CollMyItems, StartsWith("Title", TextSearchBox1.Text)),"Title", If(SortDescending1, Descending, Ascending))

 

The Sort Button

OnSelect - UpdateContext({SortDescending1: !SortDescending1})

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: Adding an Additional Sort/Filter Button

Hi @bmurphy1 

 

Can you try to update the expressions as:

The Browse Screen
OnVisible - 

ClearCollect(CollMyItems, Filter('Rep 1 Test', 'Created By'.DisplayName=_CurrentUser))


a) If you want to sort first on Title and then on ID.
The Gallery
Items - 

SortByColumns(Filter(CollMyItems, StartsWith("Title", TextSearchBox1.Text)),"Title", If(SortDescending1, Descending, Ascending),"ID", If(SortById1, Descending, Ascending))


Button to sort by ID
OnSelect - 

UpdateContext({SortById1: !SortById1})

b) If you want to toggle sort between Title and ID.
Items - 

If(SortBy = "ID",SortByColumns(Filter(CollMyItems, StartsWith("Title", TextSearchBox1.Text)),"ID",If(SortById1, Descending, Ascending)), SortByColumns(Filter(CollMyItems, StartsWith("Title", TextSearchBox1.Text)),"Title",If(SortDescending1, Descending, Ascending)))


Button to sort by ID
OnSelect - 

UpdateContext({SortBy:"ID",SortById1: !SortById1})


The Sort Button
OnSelect -

UpdateContext({SortBy:"Title",SortDescending1: !SortDescending1})

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!

bmurphy1
Level: Powered On

Re: Adding an Additional Sort/Filter Button

That seemed to break everything.  Perhaps I need to give you more of what I've written:

 

App

OnStart - Set(_CurrentUser, User().FullName)

 

Browse Screen

OnVisible - ClearCollect(CollMyItems, Filter('Rep 1 Test', 'Created By'.DisplayName=_CurrentUser, User().FullName))

 

Gallery 

OnSelect - Set(currentItem, ThisItem)

 

Items - SortByColumns(Filter(CollMyItems, StartsWith("Title", TextSearchBox1.Text)),"Title", If(SortDescending1, Descending, Ascending)) 

 

IconSortUPDown

OnSelect - UpdateContext({SortDescending1: !SortDescending1})

 

 

 

Community Support Team
Community Support Team

Re: Adding an Additional Sort/Filter Button

Hi @bmurphy1 ,

Could you describe more clearly about what you want and where did your app break?

Actually, I think the solution that @yashag2255 posted is right.

The solution means that add another button represent Id. If you click the button, your gallery could sort based on Id and Title at the same time.

He also gave two formulas based on different situations: sort based on id and title, or sort based on id or title.

There has no conflict between the formulas that you listed.

So I need more details.

If you could show me screen shoots, it will be bertter.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dual Super User
Dual Super User

Re: Adding an Additional Sort/Filter Button

Hey @bmurphy1 

 

The expression used on the OnVisible property is not correct. The correct expression should be:
OnVisible - ClearCollect(CollMyItems, Filter('Rep 1 Test', 'Created By'.DisplayName=_CurrentUser))

Have you tried to create another button for sorting by ID?

What is the issue that you are facing now? If you can share more details we might be able to help you better.

 

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!

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,861)