We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Find a word present in one field within a another String field

Ruchik
5 - Atom

Hi All, 

 

Please find below the example of the logic I want to build: 

 

ABExpected Output
BRING FOODRINGNo match
RING A BELLRINGMatch

 

This is just a sample but this is what I am trying to do. I tried using FindString([A],[B]) but it gives match in the first case as well. How can I check if the complete word present in Field B of a particular row present in String Field A in that row? 

 

Thanks for your support. 

5 REPLIES 5
smoskowitz
12 - Quasar

Hi @Ruchik --

 

Have you tried using the Contains function? That do exactly what you need.

 

Thanks,

Seth

Ruchik
5 - Atom

Hi @smoskowitz,

 

Contains also returns match for a substring (For both the cases I mentioned). I am only looking for a match when its a complete word. 

MarqueeCrew
20 - Arcturus
20 - Arcturus

I would use a FIND REPLACE tool and configure it to be a whole word match. You can also set it to be Case insensitive. Given a list of words, it can append the found word. 

also:  Regex_Match([field],".*\bRING\b.*")

 

 

cheers,

 

mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Ruchik
5 - Atom

Hi @MarqueeCrew

 

Thanks for your response. I had a small doubt with reference to RegEx as am new to it. 

 

As "ring" was just an example, I want to compare column B with A. 

 

Will the below syntax work? 

 

Regex_Match([A],".*\b[B]\b.*")

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Ruchik,

 

Let's first add test cases to your data.  They include more complexity.

 

DO NOT BRING RING No match
DO NOT RING RING Match
OK, RING TWICE RING Match

 

IF 
Getword([A],0) = [B]		THEN "Match" ELSEIF
Contains([A]," "+[B]+" ")	THEN "Match" ELSEIF
GetWord([A], CountWords([A])-1) = [B]	THEN "Match"
ELSE "No match"
ENDIF

 

This logic looks for the first word as a match, a whole word as a match and the LAST word as a match.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels
Top Solution Authors