Alteryx Designer Desktop Discussions

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

Match String separated by comma despite order of numbers

Nmassarone
8 - Asteroid

Hello, looking for help on this to see if this is a possibility.

 

I have 2 strings in different columns where the numbers are separated by a comma and trying to compare those 2 strings to see if they match despite the order of the numbers.

 

i posted an example table below.

 

I have an account number field and then in the rep column is the list if ID numbers separated by a comma.

Im trying to compare the reps column to the reps in split column to get back a TRUE/FALSE if they match

 

For example the 1st row acct 1234 the 2 reps match exact so that would be TRUE. 

The 2nd account 5678 the reps match but the order of the reps might not be exact they might be flip flopped (33484 might come first in the reps_in_split column)

The 3rd account 5644 the order might be different in this one but i would still want back a TRUE because all the repsmatch there just not in the same order as the reps column.

 

Example starting table

Acctrepssplit idreps_in_split
1234489711,12288S0123489711,12288
5678644071,33484S065433484,644071
564421001,69059,67194S091269059,21001,67194
9876547663,65311,0504,62066CC45662066,65311,0504
346535620653,621056AA658621056,620653
874334412,33484S022133484,76871
435685482554,40461CC69240461,82554

 

Example of output

Acctrepssplit idreps_in_splitMATCH
1234489711,12288S0123489711,12288TRUE
5678644071,33484S065433484,644071TRUE
564421001,69059,67194S091269059,21001,67194TRUE
9876547663,65311,0504,62066CC45662066,65311,0504FALSE
346535620653,621056AA658621056,620653TRUE
874334412,33484S022133484,76871FALSE
435685482554,40461CC69240461,82554TRUE

 

Hoping someone can help with this i really appreciate anyone taking the time to look into this.

 

thanks.

3 REPLIES 3
DataNath
17 - Castor

Would this work for you? Basically just splits and sorts both fields and then checks whether or not they're equal when rejoined.

 

DataNath_0-1652113974905.png

 

 

Nmassarone
8 - Asteroid

@DataNath perfect this works great appreciate the help on this

 

thank you

DataNath
17 - Castor

Happy to help!

 

Just shout if you need any further help. If that’s solved the issue then feel free to mark it as the solution! :)

Labels