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 / Filter Gallery on Clic...
Power Apps
Answered

Filter Gallery on Click of Buttons

(1) ShareShare
ReportReport
Posted on by 652
Hello,
 
I'm frequently struggling for one of the PowerApps form I'm creating, as I'm not too expert into this.
 
I've a Gallery, where the Items property is set as below:
SortByColumns(Search('SharePointListName', TextInput1.Text,'Customer Name', Status),"Modified", SortOrder.Descending)
TextInput1 is a Text Input added above the Gallery to Search the Gallery with Customer Name or the Status column
 
Now my requirement is to filter the Gallery by clicking the buttons
 
For Instance - I need to add a Button Called Status, Now when the user clicks the button, the Gallery should only filter where the status is called Pending and we should also get a count of how many Pending counts are there. Please note, my Status column is a calculated field and the default property is set as beow:
If(Len(DataCardValue4.Text)=0,"In Progress","Completed")
Similarly - I need to check a Date field (called as Recorded Date), which are Blanks, so when the user clicks the button, the Gallery should only filter the Dates which are blank and we should also get a count of how many Blank dates are there.
 
And lastly I should have an option to Filter the Gallery with all records by clicking a button which will be called "All"
 
Please advise. Thanks!
Categories:
I have the same question (0)
  • Verified answer
    Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    It's always best to keep your gallery filtering as simple as possible.  There are some ways to build complex filtering logic in the items property.

    Here's some ideas.
     

    Use Toggles and UpdateContext boolean variables to store your yes/no filter options.


    Use a Toggle control that updates a boolean variable for your "Search All" condition.

    OnCheck it will update context of a screen variable to true.  OnUncheck, it will set it to false.

    You can also have your "Show All" toggle reset your search text input, and any other toggles used to filter.

    Use a "Tab List" to hold the Status Column choices you want to filter by


    Here I'm displaying some custom status choices from a SharePoint list called "Approvals"



    I also added another toggle to show items that have nothing in the "Response" column.  It's redundant in my case, but I'm just showing you how to add more conditions to a filter.

    I have it update the context of a screen boolean variable

     

    The Filter:


    Use "And" and "Or" operators to build the logic of your filter.  Put each condition or level of your logic on a different line, and you can also put them in parenthesis if that helps organize it better for you. 
     
    Keep in mind that items are returned if the logic ultimately results in a "true" for each row in the data source.

    The first and most simple filter condition is whether "Show All" is checked, so that's my first line:
     
     
    vFitlerAll Or

    If vFilterAll is True, then it's True for every row in your data source and they all come through the filter.

    Put an Or after it and continue your next line of filter logic below.
     
    For the next line, I want to return items based on the selected status, to do that I write:
     
    'Approval Status'.Value = TabList_Status.Selected.Value Or

    To add another condition for my blank response filter, I add another line like:
     
    Response = Blank() And vShowNoResponse

    Since I only want to show blank Response columns if the "vShowNoResponse" value is True, I connect them with an And.


    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard