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

Multiple search using Split

Hi,
i really need your help talking about this script provided in this post

https://powerusers.microsoft.com/t5/Using-PowerApps/Search-with-multiple-words-in-multiple-columns/t....

I am trying to use the script provided in this solution but is not working really well, it shows that search only by the first information provided and is not allowing to search by more than one field.

If I search for example only putting one product code works but if I put 2 coded separated by space is not showing anything like image attached.

My code:
Filter(
AddColumns(
ProductsDatas;
"busca";
Sum(
ForAll(
Split(TextInput1.Text; " ");
Find(Result; new_name)
);
Value
)
);
busca = CountRows(Split(TextInput1.Text; " "))
)

 

 I am searching in a textbox by 2 productcodes separated by space but is not showing result on my datasource table, it shows only if I filter by only one product code.

Someone can help me finding a solution for that?

1 ACCEPTED SOLUTION

Accepted Solutions
sopatte
Microsoft
Microsoft

It seems to me that the referenced thread is about searching multiple strings that all match within a single record. The "busca" part is about counting how many matches there are in a given record, and the filter excludes those that are not matching all words. 

On the other hand, if I'm understanding, you want to match records that contain any (not all) of the words in the search box. There is probably a simpler way but I think if you replace "busca = CountRows(Split(TextInput1.Text; " "))" with "busca > 0" your code will work.

View solution in original post

2 REPLIES 2
sopatte
Microsoft
Microsoft

It seems to me that the referenced thread is about searching multiple strings that all match within a single record. The "busca" part is about counting how many matches there are in a given record, and the filter excludes those that are not matching all words. 

On the other hand, if I'm understanding, you want to match records that contain any (not all) of the words in the search box. There is probably a simpler way but I think if you replace "busca = CountRows(Split(TextInput1.Text; " "))" with "busca > 0" your code will work.

View solution in original post

It works perfectly, thanks a lot for this help.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,670)