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 / Search works fine in g...
Power Apps
Unanswered

Search works fine in gallery but not filter

(0) ShareShare
ReportReport
Posted on by 531

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

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