Skip to main content

Notifications

Community site session details

Community site session details

Session Id : skO4xDKUWz0ptmVrYJ5SiZ
Power Apps - Building Power Apps
Unanswered

Adding an Additional Sort/Filter Button

Like (0) ShareShare
ReportReport
Posted on 6 Dec 2019 00:05:04 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})

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on 12 Dec 2019 at 09:31:28
    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!

  • v-yutliu-msft Profile Picture
    on 09 Dec 2019 at 08:46:21
    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,

  • bmurphy1 Profile Picture
    68 on 06 Dec 2019 at 19:50:52
    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})

     

     

     

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on 06 Dec 2019 at 07:16:27
    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!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard