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 / Filter gallery by Drop...
Power Apps
Unanswered

Filter gallery by Dropdown and Input Text

(0) ShareShare
ReportReport
Posted on by

I'm trying filter a gallery using both a dropdown to select the column to filter by + a textfield with text to filter by.

When I have no text in the textfield, all results return ok.

However as soon as I type 1 character into the textfield - no results are turned.

 

Gallery.Items = Filter('SharepointList', StartsWith( FilterByField.SelectedText.Value, FilterByText.Text ))

FilterByField = dropdown (Items = ["Column1", "Column2", "Column3"])

FilterByText= textfield (Default = "")

 

Any ideas why this isn't working?

 

If I change the gallery to only look at a specific column, then the text filter works i.e. this works:

Gallery.Items = Filter('SharepointList', StartsWith( 'Column1', FilterByText.Text ))

 

 

 

Note: I'm using the "StartsWith" approach coupled with "choose your column" as there are >5000 records and Sharepoint is a delegated connection. The ideal would be a single text box that does a "in" search across multiple columns but that doesn't seem possible.

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

    Hi @Anonymous ,

    That is because you cannot dynamically refer to field names in Power Apps - "Column1" is the Text value "Column1", not the field. You need to hard-code this

    Filter(
     'SharepointList', 
     StartsWith(
     Switch(
     FilterByField.Selected.Value,
     "Column1",
     Column1,
     "Column2",
     Column2,
     "Column3",
     Column3
     ),
     FilterByText.Text
     )
    )

    the above however is not Delegable - if you want that, you need to go the long way

    If(
     FilterByField.Selected.Value = "Column1",
     Filter(
     'SharepointList',
     StartsWith(
     Column1,
     FilterByText.Text
     )
     ),
     FilterByField.Selected.Value = "Column2",
     Filter(
     'SharepointList',
     StartsWith(
     Column2,
     FilterByText.Text
     )
     ),
     FilterByField.Selected.Value = "Column3",
     Filter(
     'SharepointList',
     StartsWith(
     Column3,
     FilterByText.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.

    Visit my blog Practical Power Apps

  • EddieE Profile Picture
    4,641 Moderator on at

    @Anonymous 

     

    Try this

     

    Filter(
     'SharepointList',
     (StartsWith(
     Column1Name,
     FilterByText.Text
     ) || StartsWith(
     Column2Name,
     FilterByText.Text
     ) || StartsWith(
     Column3Name,
     FilterByText.Text
     )
     )
    )

     

    You can't implicitly reference column names, like you are doing, this must be explicit.

     

  • Community Power Platform Member Profile Picture
    on at

    The Delegable option worked great, thank you!

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard