cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bees
Regular Visitor

Searching with multiple key words

Hi, I'm building an app that will eventually be a searchable databse of undergraduate theses. At the moment I'm using the template provided by powerapps which is actually very similar to the style of databse I had envisaged. 

 

I'm having an issue with the search box. Ideally I would like to be able to enter multiple search terms seperated by a comma or even just a space which returns all cases that contain these terms. The search function I have come up with based on information in these forums is:

SortByColumns(Search(Table1_1,TextSearchBox1.Text,"Abstract","Author","Supervisor(s)","Project_x0020_Title"),
"Year", If(SortDescending1, Descending, Ascending))

 

When I enter a term like "biofilm" in the box it searches the columns "Abstract","Author","Supervisor(s)" and "Project Title" and returns any case containing the word biofilm in these 4 columns.

 

This is great but ideally I would like to be able to enter multiple search terms in the text box, for example "biofilm", "Smith", "ecotoxicology" to return any cases which contain these three words. Is this possible to do in Powerapps? At the moment if I enter multiple terms and the words aren't consecutive then the search returns a blank. So for example if I enter "john" "smith", projects by john smith are returned; however if I enter "smith" "ecotoxicology" then there is no cases returned.

 

Thanks!

 

 

36 REPLIES 36

I got this working using collections (check this article and this post if you need more than 2000 rows in your collection) and @CalfordMath solution to filtering a gallery using search words in any order 🙂

I have 2 columns key words and questions. I am using the code:

If(IsBlank(TextInput2.Text), Questions, Search(Search(Questions,
First(TrimEnds(Split(TextInput2.Text, ","))).Result, "crff8_keywords", "crff8_question"),
Last(FirstN(TrimEnds(Split(TextInput2.Text, ",")), 2)).Result, "crff8_keywords", "crff8_question"))

 

However if i search by Agile, Sharepoint this is not working. It stops working after i put "," between the keywords.

Please suggest

@PK_Hongsolution does not work unless you are searching exact phrases.... Use @CalfordMath solution will work with the words searched in any order.... Also no need to separate your search terms with "," 

AnjaliBargota
Frequent Visitor

Hi You can use the following Approach to meet your requirement with Split function in powerapps:

Filter(
AddColumns(
DataSource,
"found",
Sum(
ForAll(
Split(
TextInput24.Text,
" "
),
If(
IsBlank(
Find(
Lower(Result),
Lower(FieldName)
)
),
0,
CountRows(
Split(
TextInput24.Text,
" "
)
)-1
)
),
Value
)
),
found >= CountRows(
Split(
TextInput24.Text,
" "
)
)
)

 

This is brilliant, @CalfordMath -- just what I needed. Tweaked it a bit to work with a multi-select ComboBox and worked a treat... Thanks very much for sharing!

Hi @CalfordMath ,

can i check is there any way to filter multiple nonconsecutive keywords with the results highlighted? Thank you.

brilliant solution: it helped me

thanks

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (2,960)