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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding an Additional S...
Power Apps
Unanswered

Adding an Additional Sort/Filter Button

(0) ShareShare
ReportReport
Posted on by 68

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})

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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 Profile Picture
    68 on at

    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})

     

     

     

  • v-yutliu-msft Profile Picture
    on at

    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,

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard