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 / Filtering a Gallery wi...
Power Apps
Answered

Filtering a Gallery with a Text Box

(0) ShareShare
ReportReport
Posted on by 40

Hello, I am trying to filter a gallery with both dropdowns and a text input box. Here is the formula that I have currently. I can't seem to figure out how to add the search function to what I already have to allow the gallery to also be filtered by the text input box.

 

If(
    //Returns all locations if both dropdowns are set to "All"
    areadropdown.Selected.Value = "All" And buildingdropdown.Selected.Value = "All", 'CB Locations',

    //Returns locations matching the selected "buildingdropdown" value
    areadropdown.Selected.Value = "All" And buildingdropdown.Selected.Value <> "All",
    Filter('CB Locations', Building.Value = buildingdropdown.Selected.Value),

    //Returns locations matching the selected "areadropdown" value
    areadropdown.Selected.Value <> "All" And buildingdropdown.Selected.Value = "All",
    Filter('CB Locations', Area.Value = areadropdown.Selected.Value),

    //Returns locations matching the selected value of both dropdowns
    areadropdown.Selected.Value <> "All" And buildingdropdown.Selected.Value <> "All",
    Filter('CB Locations', Area.Value = areadropdown.Selected.Value And Building.Value = buildingdropdown.Selected.Value)
)
Categories:
  • JacksonG Profile Picture
    40 on at

    My Sharepoint list also contains choice columns, which I assume will affect how I can solve this. Forgot to put this in the original post.

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    Hi @JacksonG ,

    Depending on your data source, this may not be Delegable

    Search(
     Filter(
     'CB Locations',
     (
     areadropdown.Selected.Value = "All" ||
     Area.Value = areadropdown.Selected.Value
     ) &&
     (
     buildingdropdown.Selected.Value = "All" ||
     Building.Value = buildingdropdown.Selected.Value
     )
     ),
     YourSearchBox.Text,
     "YourSearchField"
    )

     

    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

  • JacksonG Profile Picture
    40 on at

    Apologies if this should've been obvious, but how should I combine what you commented with my current formula?

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    @JacksonG ,

    What I have posted is your current formula condensed/optimised with a Search added.

  • JacksonG Profile Picture
    40 on at

    I see. When I use what you have posted I receive "The function "Search" has some invalid arguments."  Do you know what the cause of this might be?

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    @JacksonG ,

    You need to put in your actual search box and searched field names.

  • JacksonG Profile Picture
    40 on at

    Okay, I've changed the formula to match the names I have.
    Here's what I have now, but I am having issues with the "Area" and "Building" columns. These are choice columns in a Sharepoint list, while the "Room" and "Description" columns are text. Unsurprisingly, I'm getting the warning "Wrong column type. Expects text type."
    How would I go about resolving this? I have tried using "AddColumns", but I feel like that is not the correct approach.

    Search(
    Filter(
        'CB Locations',
        (areadropdown.Selected.Value = "All" || Area.Value = areadropdown.Selected.Value) && (buildingdropdown.Selected.Value = "All" || Building.Value = buildingdropdown.Selected.Value)
    ),
    searchtextbox.Text, "Area", "Building", "Room", "Description")


  • Verified answer
    WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    @JacksonG ,

    Yes - AddColumns is the approach as you cannot search in Choice columns.

    Search(
     AddColumns(
     Filter(
     'CB Locations',
     (
     areadropdown.Selected.Value = "All" || 
     Area.Value = areadropdown.Selected.Value
     ) && 
     (
     buildingdropdown.Selected.Value = "All" || 
     Building.Value = buildingdropdown.Selected.Value
     )
     ),
     "AreaVal",
     Area.Value,
     "BuildingVal",
     Building.Value
     ),
     searchtextbox.Text,
     "AreaVal",
     "BuildingVal", 
     "Room", 
     "Description"
    )

     

    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

  • JacksonG Profile Picture
    40 on at

    Awesome, 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard