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

Keyword search on multiple columns

I have seen several posts on this topic, but none fit my use case.  I have a gallery connected to a SP list.  I have put in text input box and am referencing that in my search code.  I am not concerned with sorting, I just want to be able to type in one part of a variety of data points and have the list item display, so STARTS WITH is not an option for me. 

 

in the below code the search works perfect when just 'Title' and "Course_x0020_ID" stated.  if I change either of those or add on additional columns to search in, the gallery disappears and it says I have an error.  How can I search in the 5 columns I show in the code below? Also - this list could grow to larger than 500, I have seen some limitations around capacity.  I welcome feedback to work around the capacity issue

 

My list name is: BOE

 

Search([@BOE],txtBOESearch.Text,"Title","Course_x0020_ID","End_x0020_Date","Start_x0020_Date","Session_x0020_ID")

 

14 REPLIES 14

@CNT Any clue what else I could look at to troubleshoot why mine isn't working?

RandyHayes
Super User
Super User

@JTischler 

Your formula is not correct, change to:

Filter([@BOE], txtBOESearch.Text in Title ||
	txtBOESearch.Text in Course_x0020_ID ||
	txtBOESearch.Text in End_x0020_Date ||
	txtBOESearch.Text in Start_x0020_Date ||
	txtBOESearch.Text in Session_x0020_ID
)

 

You can also shorten and resolve the blank search with:

Filter([@BOE], 
   txtBOESearch.Text in 
    Title & "|" & Course_x0020_ID & "|" & End_x0020_Date & "|" & Start_x0020_Date & "|" & Session_x0020_ID ||
   IsBlank(txtBOESearch.Text)
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
RandyHayes
Super User
Super User

@JTischler 

OH...and as to your original post problem, you can use search, but you can only search on Text columns.  So if any of your columns are numeric or date or something else, then you need to convert to text.

Ex.

Search(
    AddColumns([@BOE], 
        "_endDate", Text(End_x0020_Date, ShortDate),
        "_startDate", Text(Start_x0020_Date, ShortDate),
        "_sessionID", Text(Session_x0020_ID)
    ),
    txtBOESearch.Text, 
    "Title", "Course_x0020_ID", "_endDate", "_startDate", "_sessionID"
)

 

However, as you pointed out, this is not delegable, so if your source (BOE) contains more than 2000 records, then you will start to get incomplete results.

But, if you can pre-filter the BOE table, then you could still do non-delegable functions on the prefilter without any issue.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes  Great!!  I will work on this tweak to accommodate as two of the fields are date fields and I would want mm/dd/yy or yyyy or partial date entries to be accepted.

RandyHayes
Super User
Super User

@JTischler 

Yes, the revised Search function that I provided would give you that functionality.

 

OR, if you're going with the Filter function, then change to:

Filter([@BOE], 
   txtBOESearch.Text in 
    Title & "|" & Course_x0020_ID & "|" & Text(End_x0020_Date,ShortDate) & "|" & Text(Start_x0020_Date, ShortDate) & "|" & Session_x0020_ID ||
   IsBlank(txtBOESearch.Text)
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,943)