cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
edurocha
Level: Power Up

Search multiple words

Hi everybody.

I've a table called TB_Orientacao with 4 fields (PK, Fd1, Fd2, Fd3) and I need to make a search in the last 3 columns. 

 

The line belows works fine

Filter(TB_Orientacao; TextToSearch.Text in Fd1 & " " & Fd2 & " " & Fd3);

 

But there's an problem: When I type "my search" locate ONLY "my search" and in this order. But I need to search different words "my" and "search" and others.

 

I've tryed this solution (link), but didn't work. See my code in Gallery.Items
Filter

(
    AddColumns

    (
         TB_Conteudo;
         "present";
         Sum

         (
             ForAll

             (
                 Split(TextToSearch.Text; " ");
                 If(IsBlank(Find(Result; Fd1)); 0; 1)
             );
             Value
        )
    );
    present = CountRows(Split(TextToSearch.Text; " "))
)

 

What should I do?

2 REPLIES 2
Super User
Super User

Re: Search multiple words

@edurocha 

There are a couple ways to go about it.  Here is one potential solution for you that is based on the formula you supplied.

This one assumes that the columns you want to search are text columns.

The formula would be similar to this:

 

Filter(
AddColumns(TB_Conteudo;
"found";
Sum(
ForAll(Split(TextToSearch.Text; " ");
Find(Result; PK) +
Find(Result; Fd1) +
Find(Result; Fd2) +
Find(Result; Fd3)
); Value)
);
"found" > 0
)

I will start with that one for you.  If you have other needs for this search, just post back and let me know and I will offer some additional suggestions.  This particular one will match any record that has any of the words in the search text in any of the columns.  If you need a more restrictive search (must be in all, all words must be found in any columns, etc) then let me know.

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Administrator
Administrator

Re: Search multiple words

Thanks for posting in the community @edurocha - can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 150 members 3,764 guests
Please welcome our newest community members: