cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Jsmilde
Level: Powered On

Search with multiple keywords

Hi,

 

I've created a nice knowledge management application where people can find there answer very quickly. Now because of the fact the knowledge within in the database is growing and growing there was some feedback from the users if it is possible to search on multiple words like "Holiday", "Procedure" So that you will find for examplewithin the database: "here you can find when you can go on a holiday. Please click on the procedure.. etc."

 

So that the above keywords will also give results even if it is not in order.

 

Hope some can help me with this? 

 

I know btw That there was an article where there was a solution with i thought to create columns etc. But I can't find this articile anymore.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Search with multiple keywords

Hello,

I am sorry for my late reply. 

You can see three controls. A Button, a Gallery and a TextInput
Sample.gif

 

Button1.OnSelect =  ClearCollect(Collection1,"John smith","Holiday","ecotoxicology test","test string")

Gallery1.Items= 
If(IsBlank(TextInput1.Text),
RenameColumns(Collection1,"Value","Result"),
Distinct(Ungroup(ForAll(Filter(Split(Lower(TextInput1.Text),","),!IsBlank(Result)),Filter(Collection1,!IsBlank(Find(TrimEnds(Result),Lower(Value))))),"Value"),Value))

The name of the text input control is TextInput1

You can try to have the names that you use for the collection and the controls and I hope it will also work for you. 🙂
The code is used because there is no function to do what you need 😞

View solution in original post

11 REPLIES 11
PK_Hong
Level 8

Re: Search with multiple keywords

Hi @Jsmilde

 

Search shall be waht you need.

 

The Search function finds records in a table that contain a string in one of their columns. The string may occur anywhere within the column; for example, searching for "rob" or "bert" would find a match in a column that contains "Robert". Searching is case-insensitive. Unlike Filter and LookUp, the Search function uses a single string to match instead of a formula.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

Thanks

Jsmilde
Level: Powered On

Re: Search with multiple keywords

https://powerusers.microsoft.com/t5/Using-PowerApps/Search-with-multiple-words-in-multiple-columns/t... This was the solution. Searched in my histery, access denied at this moment.

Jsmilde
Level: Powered On

Re: Search with multiple keywords

At the moment i've multiple colums with one searchbar:

 

SortByColumns(Filter(APP, SearchInput.Text in Title || SearchInput.Text in Antwoord || SearchInput.Text in Steekwoorden),"Views",Descending)

 

You need to replace this with a search function? 

 

I would like to be able to enter multiple search terms in the text box whic will search in multiple columns. 

 

btw thanks for the quick reply!

 

 

 

 

PK_Hong
Level 8

Re: Search with multiple keywords

Hi

 

Search( Table, SearchString, Column1 [, Column2, ... ] )

 

Please replace Filter with Search(APP, SearchInput.Text, “FieldTitle1", "FieldTitle2", ....) and you can still enclosed in SortbyColumns.

So, whatever you type into SearchInput box, it will immediately search for the CONTENTS in those fileds, show the results in the gallery, start from FieldTitle1, FieldTitle2, etc.

 

Search is the best solution.


Best wishes

 

Jsmilde
Level: Powered On

Re: Search with multiple keywords

Yeah that is right, but i mean if you use for example: Holiday and Salary within the textfield and it's not near eachother within the string of the database you can't find the record. 

 

FE:

 

 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.  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.

Super User
Super User

Re: Search with multiple keywords

Hello,

I think that the functionality that you are looking for, is here. I don't know though if it is slow, when you try it for a big amount of data. 

Button1.OnSelect = ClearCollect(A,"John smith","Holiday","ecotoxicology test","test string")
Gallery1.Items= Distinct(Ungroup(ForAll(Filter(Split(Lower(TextInput1.Text),","),!IsBlank(Result)),Filter(A,!IsBlank(Find(TrimEnds(Result),Lower(Value))))),"Value"),Value)

In the search textinput that you use (TextInput1 in the expression above) you can separate the different words by the comma seperator <,>.
Example Textinput1.Text = John,ecotox It will return the two results that you asked for.
If you want to change the seperator, you can replace the comma with the red color in the expression.

Kind regards,
Michalis




Jsmilde
Level: Powered On

Re: Search with multiple keywords

It's not working jet... I think i'm stupid 🙂

 

Could you please give an example with some screenshots o.i.d? So i can interpretent it better for my own situation. And why you use some codes? What does it solve? So i will understand that more:) 

 

Super User
Super User

Re: Search with multiple keywords

Hello,

I am sorry for my late reply. 

You can see three controls. A Button, a Gallery and a TextInput
Sample.gif

 

Button1.OnSelect =  ClearCollect(Collection1,"John smith","Holiday","ecotoxicology test","test string")

Gallery1.Items= 
If(IsBlank(TextInput1.Text),
RenameColumns(Collection1,"Value","Result"),
Distinct(Ungroup(ForAll(Filter(Split(Lower(TextInput1.Text),","),!IsBlank(Result)),Filter(Collection1,!IsBlank(Find(TrimEnds(Result),Lower(Value))))),"Value"),Value))

The name of the text input control is TextInput1

You can try to have the names that you use for the collection and the controls and I hope it will also work for you. 🙂
The code is used because there is no function to do what you need 😞

View solution in original post

Jsmilde
Level: Powered On

Re: Search with multiple keywords

Is this also possible with a sharepoint database?

 

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,493)