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 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
    154,534 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard