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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Search works fine in g...
Power Apps
Unanswered

Search works fine in gallery but not filter

(0) ShareShare
ReportReport
Posted on by 603

I have gallery with SharePoint as the datasource. Outside the gallery I have a searchbox and a filter pane which includes 4 buttons named "Electrical Stuffs", "Home Appliances", "Drinks", "Perfumes"

 

The search functionality works fine without any issues. Below is the formula for Items property of Gallery

 

Filter(
DataSource,
(TextInput1.Text in 'Name' || TextInput1.Text in Description || TextInput1.Text in 'Unit Price' || TextInput1.Text in 'Category')
)

 

However when i try to add the filter buttons in above formula, gallery doesnt filter appropriately. 

 

On each of the 4 buttons OnSelect, I used below formula

 

UpdateContext({varSelection:"Electrical Stuffs"})

UpdateContext({varSelection:"Home Appliances"})

UpdateContext({varSelection:"Drinks"})

UpdateContext({varSelection:"Perfumes"})

 

Amended Items property of gallery to below formula

 

Filter(
DataSource,
(TextInput1.Text in 'Name' || TextInput1.Text in Description || TextInput1.Text in 'Unit Price' || TextInput1.Text in 'Category')&&varSelection=Category
)

 

Any where I am going wrong?

Categories:
I have the same question (0)
  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    The issue in your formula lies in the line where you compare varSelection with Category in the Filter function. Instead of varSelection=Category, you need to use varSelection = Category to properly compare the two values. Here's the corrected formula:

     

    Filter(
     DataSource,
     (TextInput1.Text in 'Name' || TextInput1.Text in Description || TextInput1.Text in 'Unit Price' || TextInput1.Text in 'Category') && varSelection = Category
    )

     

    Ensure that the variable Category is the column name in your SharePoint list that stores the category value for each item.

    Additionally, when you set the varSelection variable in the OnSelect property of the buttons, make sure you are using the correct category value. For example, if the button is for "Electrical Stuffs," the formula should be:

     

    UpdateContext({varSelection: "Electrical Stuffs"})

     

    Make sure you use the appropriate category values for each button.

    By correcting these issues, the gallery should filter the items correctly based on both the search text and the selected category.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard