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 and Searchin...
Power Apps
Answered

Filtering and Searching using two search fields

(0) ShareShare
ReportReport
Posted on by 16

I've looked this question up, but it's really difficult for me to parse how I'm supposed to fix any of this.

 

I'm making an app that will allow a user to look at a machine and its details.  I want them to sort by business unit, and then have the option to look up a machine in the gallery.

 

But I'm getting nothing but errors. Here are the multiple attempts I have made:

 

__

(Search(newunit1,TextSearchBox1.Text, "MACHINE")

 

SortByColumns(Search(Search(newunit1,TextSearchBox1.Text, "MACHINE"), Dropdown1.SelectedText, "UNIT"

 

SortByColumns(Filter(newunit1, "UNIT" = Dropdown1.SelectedText), "UNIT", SortOrder.Ascending, SortByColumns(Search([@newunit1], TextSearchBox1.Text, "MACHINE"), "MACHINE", SortOrder.Ascending)

 

__

TextSearchBox1 is supposed to reference the machine name. Dropdown 1 is supposed to be the business units. I'm sure this is very simple, but I can't wrap my head around it. Any help is much appreciated.

 

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

    @heiavieh , for a delegable solution, try using the StartsWith function which limits the search to the beginning of the text:

     

    SortByColumns(
     Filter(
     newunit1,
     StartsWith(
     'the column you want to search',
     TextSearchBox1.Text
     ),
     Len(Dropdown1.Selected.Value) = 0 || 'the column you want to filter on' = Dropdown1.Selected.Value
     ),
     "UNIT",
     SortOrder.Ascending
    )
    

     

    If you need to use the Search function (which is not limited to searching the beginning of text but is not delegable), you can partially delegate this with:

     

    With(
     {
     _data: Filter(
     newunit1,
     Len(Dropdown1.Selected.Value) = 0 || 'the column you want to filter on' = Dropdown1.Selected.Value
     )
     },
     SortByColumns(
     Search(
     _data,
     TextSearchBox1.Text,
     "the column you want to search on"
     ),
     "UNIT",
     SortOrder.Ascending
     )
    )

     

    Note the above assumes the column you want to ilter your dropdown on is not a SharePoint Choice data type. If the column is a single select Choice data type, you need to change this line:

     

    'the column you want to filter on'

     

    To:

     

    'the column you want to filter on'.Value

     

     

    I see you're a new community member so if none of this is making sense, feel free to ask questions.

     

    For more information on what delegation is, see here: 

    https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/delegation-overview 

  • mbarbosa Profile Picture
    146 on at

    Are you setting that formula as your gallery items property? Maybe you want to create a search button/icon and use the formula on its OnSelect event.

    I believe you should use something like this:

    ClearCollect(ItemsCollection,Filter(newunit1,UNIT=Dropdown1.Selected.Value,TextSearchBox1.Text in MACHINE))

    And then you use that collection (ItemsCollection) in the Gallery items property.

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard