Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Match One Value between Two Strings

Bonediggler
9 - Comet

Experts - 

 

Here's the case: I need to figure out if there is at least one common value present in 2 different strings.  For example:

 

String A: 123, abd, edf

String B: 345,edf,789

 

In this case there is a match on "edf". 

 

I am looking for a solution that:

> Doesn't involve parsing and then transposing the strings as that will create millions of records

> Leaves the strings as they are

> Doesn't involve lots of tools - as I already have a solution that involves lots of tools

 

If I am overlooking an existing function or simple process to get this done, please let me know!

 

Thanks in advance!

20 REPLIES 20
Luke_C
17 - Castor
17 - Castor

Are these strings different fields in the same record? Or on different records that share a common ID or grouping?

 

If they're in the same record, you could filter to these records by doing something like:

Contains([String A],'edf') AND Contains([String B], 'edf')

Bonediggler
9 - Comet

Different fields in the same record.  The problem is I don't know if or what the matching value would be between fields.

 

"edf" was just an example - not necessarily a known value I am looking for.

atcodedog05
22 - Nova
22 - Nova

Hi @Bonediggler 

 

Can you provide the expected output? what is the output after comparing?

Bonediggler
9 - Comet

Boolean: match = true/no match = false

Luke_C
17 - Castor
17 - Castor

Hmm I see, needs to dynamically check to see if there's something in common. I can't think of any solution that doesn't include parsing it out but maybe some of the other smart people here can. 

john_watkins
11 - Bolide

Are the values to be tested delimited, and if so, is there really a common delimiter?  Your sample leads me to believe it is  "," that is what tells the tokens apart.

Bonediggler
9 - Comet

 Sorry - yes, comma delimiter

Maskell_Rascal
13 - Pulsar

Hi @Bonediggler 

 

If the comma is your common delimiter, you can use a couple Text to Columns and a Filter to find only the strings that match. I mocked up 300,000 rows of data using this method, which ballooned up to 2.7M rows after the Text to Columns tools, and it ran in about 2 seconds.

 

Maskell_Rascal_0-1627583213714.png

 

Cheers!

Phil

Bonediggler
9 - Comet

I am working with millions of rows and up to dozens of values per string so this method might cause Alteryx to explode, but it definitely is one solution!

Labels
Top Solution Authors