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 with filtered c...
Power Apps
Answered

Search with filtered conditions

(0) ShareShare
ReportReport
Posted on by

Hello, 

i have a simple app with a textfield searchTextField and a gallery myGallery.

on the gallery item i have a simple code

Search(
 AddColumns(
 mySPList,
 "UserName",
 User.DisplayName
 ),
 searchTextField.text,
 "UserName",
 "email",
 "country"
 )

and it works fine.

 

now i want to add some checkboxes to allow some sort of filtering to my gallery. I want to have one checkbox for Email, one for the Age and one checkbox for Country.

If no checkbox is set, the search must be done only in the UserName field, otherwise it should search also in the fields specified by the user with the checkboxes. For instance, if the user check email, the gallery should show the items searching the value inside the username and also the email.

 

how can i do that?

 

I figured i could put my search inside an if, but it would be way too many nested conditions. I tried to put the last field of the search function as a variable so i could "build" it, but it won't accept it. 

 

Any clue? 

thanks

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,415 Most Valuable Professional on at

    Hi @Antonioclk ,

    I have use example check box names here

    Filter(
     AddColumns(
     mySPList,
     "UserName",
     User.DisplayName
     ),
     (!chkUser || searchTextField.Text in UserName) &&
     (!chkEmail || searchTextField.Text in email) &&
     (!chkCountry || searchTextField.Text in country)
    )

     

    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

  • Antonioclk Profile Picture
    on at

    thank you so much 🙂

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

#2
Kalathiya Profile Picture

Kalathiya 340

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard