cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
amemartinez
Helper II
Helper II

How to Search Multiple Keywords in a Text Box

HELP!!! I am new at this and I am having trouble with one field of my first app.

 

I have a Text Input field that I want users to be able to search multiple keywords at the same time. For example: if a user types Williamson, Travis in the County search box (text input field) I want the results to show all the data cards that contain Williamson and Travis. Right now if you type multiple things like Williamson,Travis or Williamson, Travis or Williamson Travis the gallery goes blank. 

 

This is my gallery formula. If there is a formula that can make the above possible where would I put it (Formulas still confuse me):

Search(Search(Search(Search(Search(Search(Search(Search(Search(TransportationProviders,txtStateFilter.Text,"State"),txtCountyFilter.Text,"County"),txtZipCodeFilter.Text,"ZIP"),txtVendorLookup.Text,"Title"),txtAMBFilter.Text,"Ambulatory"),txtWCVFilter.Text,"WCV"),txtWCVXLFilter.Text,"WCV_XL"),txtTaxiFilter.Text,"Livery_x002f_Taxi"),txtStretcherFilter.Text,"Stretcher_x002f_Gurney")

 

Thank you in advance for any assistance you can provide me with.

 

5 REPLIES 5
WiZey
Super User
Super User

Hello @amemartinez ,

 

If I didn't misunderstand, your table look like this:

 

  • State
  • County
  • ZIP
  • Title
  • Ambulatory
  • WCV
  • WCV_XL
  • Livery_x002f_Taxi
  • Stretcher_x002f_Gurney

You have an input field for each of these columns, and you are trying to get the records whose column's value match with the input's value?

 

Would a mix-up of "Filter()" and "Split()" work for you?

 

Filter(TransportationProviders,
   And("State" in Split(txtStateFilter.Text, ","),
       "County" in Split(txtCountyFilter.Text,","),
       "ZIP" in Split(txtZipCodeFilter.Text,","),
       "Title" in Split(txtVendorLookup.Text,","),
       "Ambulatory" in Split(txtAMBFilter.Text,","),
       "WCV" in Split(txtWCVFilter.Text,","),
       "WCV_XL" in Split(txtWCVXLFilter.Text,","),
       "Livery_x002f_Taxi" in Split(txtTaxiFilter.Text,","),
       "Stretcher_x002f_Gurney" in Split(txtStretcherFilter.Text,",")
   )
)

 

I want to be able to just search the County field in the data source, which is one column. So in the CountyFilter text box I want the user to be able to type Wiliamson, Travis and the app would search just the County field for those words and return the records. So the other fields like State, Zip code, Vendor Lookup, etc would be blank and the only box that would have anything in it would be the County box. Does that make sense?

@amemartinez ,

If you want to search for comma separated values individually, you can do this for one input field, but would have to use the same one for each table field

Ungroup(
   ForAll(
      Split(
         txtCountyFilter.Text,
         ","
      ),
      Filter(
         TransportationProviders,
         Trim(Result) in County ||
         Trim(Result) in State ||
         Trim(Result) in Zip ||
         . . . . . . . . . .
      )
   ),
   "Value"
)

 

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

So I entered in the above formula but I am getting blue squiggly line under || and nothing is showing up in my data cards now. This is what I entered in:

 

Ungroup(ForAll(Split(txtCountyFilter.Text,", "),Filter(TransportationProviders,Trim(Result) in txtCountyFilter || Trim(Result) in txtStateFilter || Trim(Result) in Zip || Trim(Result) in txtVendorLookup || Trim(Result) in txtWCVFilter || Trim(Result) in txtWCVXLFilter || Trim(Result) in txtAMBFilter || Trim(Result) in txtStretcherFilter)),"Value")

 

Then I tried entering exactly what you put and I get a red squiggly line under all of the red text and blue squiggly under all of the blue below:

 

Ungroup(ForAll(Split(txtCountyFilter.Text,", "),Filter(TransportationProviders,Trim(Result) in County || Trim(Result) in State || Trim(Result) in Zip || Trim(Result) in Vendor Lookup || Trim(Result) in WCV || Trim(Result) in WCVXL || Trim(Result) in AMB || Trim(Result) in Stretcher)),"Value")

 

What am I missing? 

 

I want the reps to be able to search some or all of the text boxes at the same time. Sometimes they won't need to do that but other times they will. I want them to be able to enter multiple county names in the County search box if they need to while utilizing the other search boxes as well. Does this make sense?

 

This is what the filter pane looks like that I made, that I want them to utilize to get the data of what they need:

amemartinez_0-1657037954874.png

 

@amemartinez ,

The blue line is a Delegation warning as the in filter and Ungroup are not Delegable (neither is Search). If your data source is over 500 records (you can increase this to 2,000), you will only get results from the first 500-2,000 records. You could normally use StartsWith for the filter, but you have the complication of having to split the first values, making it a many-to-many search. You simply cannot do what you are trying on a data set over 2,000 records.

 

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

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (3,708)