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 / Filter Gallery by Mult...
Power Apps
Unanswered

Filter Gallery by Multi-Select Choice Column AND Text Search (Sharepoint Data Source)

(0) ShareShare
ReportReport
Posted on by 12

Good afternoon,

 

is there a way to filter a Gallery using a Combobox (or dropdown) for a Multi-Select Choice Column in Sharepoint AND have a Text Search box for a Text field?

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    Hi @zachary_stern21 ,

     

    You could use something like:

     

    Filter(
     YOUR_DATA,
     CountRows(YOUR_COMBOBOX.SelectedItems) = 0 || 'YOUR_MULTI_CHOICE_FIELD' in YOUR_COMBOBOX.SelectedItems,
     IsBlank(YOUR_SEARCH_BOX.Text) || StartsWith(
     'YOUR_COLUMN_TO_SEARCH',
     YOUR_SEARCH_BOX.Text
     )
    )

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved.

    If you like my response, please give it a Thumbs Up.

     

     

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    Hi @zachary_stern21 ,

    Yes, it is possible. Please share your code (in Text) you have attempted and also the names of all controls and fields (with field types) and the List. Also is the multi-select Combo Box querying a multi-value Choice field or a Text field ?

  • zachary_stern21 Profile Picture
    12 on at

    So I went ahead and created two new Choice columns in Sharepoint (I am only using one here called Primary Precinct, and it does NOT allow for multi-select). The code below works to search by text and by the combobox for Primary Precinct. The multi-select choice field I would LIKE to use is called Harris Precinct.

     

    Filter(
    'HCFCD Projects',
    And(
    Or(
    IsBlank(PrecComboBox.SelectedItems),
    IsEmpty(PrecComboBox.SelectedItems),
    'Primary Precinct'.Value = Last(
    FirstN(
    PrecComboBox.SelectedItems,
    1
    )
    ).Value,
    'Primary Precinct'.Value = Last(
    FirstN(
    PrecComboBox.SelectedItems,
    2
    )
    ).Value,
    'Primary Precinct'.Value = Last(
    FirstN(
    PrecComboBox.SelectedItems,
    3
    )
    ).Value,
    'Primary Precinct'.Value = Last(
    FirstN(
    PrecComboBox.SelectedItems,
    4
    )
    ).Value
    ),
    StartsWith(
    'Project Title',
    PNSearch.Text
    )
    )
    )

  • zachary_stern21 Profile Picture
    12 on at

    Though I only have 20 records right now, I would like to make the function Delegable in case we get a ton of projects and because I'd just like to know how to do that for other applications. Thanks!

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    Hi @zachary_stern21 ,

    Assuming you are only ever going to have 4 selections,

    With(
     {
     w1: Index(PrecComboBox.SelectedItems,1).Value,
     w2: Index(PrecComboBox.SelectedItems,2).Value,
     w3: Index(PrecComboBox.SelectedItems,3).Value,
     w4: Index(PrecComboBox.SelectedItems,4).Value
     },
     Filter(
     'HCFCD Projects',
     (
     CountRows(PrecComboBox.SelectedItems) = 0 ||
     (
     'Primary Precinct'.Value = w1 ||
     'Primary Precinct'.Value = w2 ||
     'Primary Precinct'.Value = w3 ||
     'Primary Precinct'.Value = w4
     )
     ) &&
     StartsWith(
     'Project Title',
     PNSearch.Text
     )
     )
    )

     

    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

  • zachary_stern21 Profile Picture
    12 on at

    Thanks for this but its not returning any data. It looks like there is a } missing. I tried to add that and amend the code, still no dice. Here is what I have right now (I duplicated the screen to test this out so the combobox and search box name is slightly changed:

     

    With(
    {
    w1: Index(PrecComboBox_1.SelectedItems,1).Value,
    w2: Index(PrecComboBox_1.SelectedItems,2).Value,
    w3: Index(PrecComboBox_1.SelectedItems,3).Value,
    w4: Index(PrecComboBox_1.SelectedItems,4).Value},
    Filter(
    'HCFCD Projects',
    (
    CountRows(PrecComboBox_1.SelectedItems) = 0 ||
    (
    'Primary Precinct'.Value = w1 ||
    'Primary Precinct'.Value = w2 ||
    'Primary Precinct'.Value = w3 ||
    'Primary Precinct'.Value = w4 ||
    )
    ))
    && StartsWith('Project Title', PNSearch_1.Text ))

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    @zachary_stern21 ,

    Please see amended post - yours has a bracket in the wrong place.

  • zachary_stern21 Profile Picture
    12 on at

    There is an error (Incompatible types for comparison. These types can't be compared: Table, Text) after the CountRows function (Precinct'.Value = w1) over the equals sign. I think that statement ((Precinct'.Value = w1) is returning a table of values where we need an individual record

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    @zachary_stern21 ,

    I just ran this code after creating a collection with field names and types the same as your as well as control names the same - the below worked perfectly and returned the expected results (CountRows got no errors - it just does not seem to want to filter all when blank). You also had an extra || after w4

    With(
     {
     w1: Index(PrecComboBox_1.SelectedItems,1).Value,
     w2: Index(PrecComboBox_1.SelectedItems,2).Value,
     w3: Index(PrecComboBox_1.SelectedItems,3).Value,
     w4: Index(PrecComboBox_1.SelectedItems,4).Value
     },
     Filter(
     'HCFCD Projects',
     (
     IsEmpty(PrecComboBox_1.SelectedItems) ||
     (
     'Primary Precinct'.Value = w1 ||
     'Primary Precinct'.Value = w2 ||
     'Primary Precinct'.Value = w3 ||
     'Primary Precinct'.Value = w4
     )
     ) &&
     StartsWith(
     'Project Title',
     PNSearch_1.Text
     )
     )
    )

     

    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

     

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard