Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Multiple sort/filters in gallery

(0) ShareShare
ReportReport
Posted on by 16

Hi, could anyone help with how to format the below so I don’t get errors? I am trying to do the following to my gallery: 

Search bar filter 

Combobox filter x 2 

Filter what can be seen so admin can see all but users can only see their own department.

Sort the gallery to the newest items are at the top.

Below is copied from the items part of my gallery: 

Sort(

    Filter(
        '0301 HQSW G6 BC App Reg',
        varReset && (StartsWith(Title,SearchbarOPBC_1.Text) && (Len(ComboBoxSystem2_1.Selected.Value) = 0 || System.Value = ComboBoxSystem2_1.Selected.Value) && (Len(ComboBoxStatus2_1.Selected.Value) = 0 || Status.Value = ComboBoxStatus2_1.Selected.Value) && (VarUserAdmin= true || Unit.Value = VarUserUnit.Value)
    ),
    Modified,

    SortOrder.Descending)

 

Thanks

  • WarrenBelz Profile Picture
    WarrenBelz 145,495 on at
    Re: Multiple sort/filters in gallery

    Hi @Ajam88 ,

    Try this

    With(
     { 
     wField:
     Switch(
     locSortColumn,
     "Collection date",
     "Collectiondate",
     "Return date",
     "Returndate"
     ),
     wOrder:
     If(
     locSortAscending, 
     SortOrder.Ascending, 
     SortOrder.Descending
     )
     },
     SortByColumns(
     Filter(
     'BC Loan Archive',
     StartsWith(
     Title, 
     BdeRefSearch.Text
     )
     ),
     wField,
     wOrder
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Ajam88 Profile Picture
    Ajam88 16 on at
    Re: Multiple sort/filters in gallery

    Hi @WarrenBelz, I seem to have real trouble with the filtering in gallery’s. You have helped me a few times with this so hoping you might be able to again. I have got a the following which throws no errors but it’s not having the desired impact, the final Filter piece is supposed to filter the text column when I type in the search box. But it’s not working. I am assuming it’s something to do with the earlier switch function but I can’t seem to get it sorted. Any help would be greatly appreciated! 

    Switch(locSortColumn, "Collection date", Sort('BC Loan Archive', Collectiondate, If(locSortAscending, SortOrder.Ascending, SortOrder.Descending)), "Return date", Sort('BC Loan Archive', Returndate, If(locSortAscending, SortOrder.Ascending, SortOrder.Descending)), Filter('BC Loan Archive',(StartsWith(Title, BdeRefSearch.Text))))

  • WarrenBelz Profile Picture
    WarrenBelz 145,495 on at
    Re: Multiple sort/filters in gallery

    Hi @Ajam88 ,

    You are missing a bracket for a start

    Sort(
     Filter(
     '0301 HQSW G6 BC App Reg',
     varReset && 
     (
     StartsWith(
     Title,
     SearchbarOPBC_1.Text
     ) && 
     (
     Len(ComboBoxSystem2_1.Selected.Value) = 0 || 
     System.Value = ComboBoxSystem2_1.Selected.Value
     ) && 
     (
     Len(ComboBoxStatus2_1.Selected.Value) = 0 || 
     Status.Value = ComboBoxStatus2_1.Selected.Value
     ) && 
     (
     VarUserAdmin= true || 
     Unit.Value = VarUserUnit.Value
     )
     )
     ),
     Modified,
     SortOrder.Descending
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard