Alteryx Designer Desktop Discussions

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

How to use the IN function flexibly based on a field instead of set values?

AkisM
10 - Fireball

I am trying to filter my data with the IN function. I want to check that my field CODE is does not contain any value from a long list of possible codes. Instead of manually writing down a 10 mile long "[CODE] NOT IN ('US9841983','JF98324723,'JI83872920'....) expression, I just want to use a specific field that contains all those values. I tried creating that field by concatenating my data into a single field with comma as separators and ' at the start and beginning of each value, but when I tried to use the field in the NOT IN expression of the filter tool, the results were not as I expected.

 

Can someone share a working example below of what I am describing? My original data looks something like this (but a lot more codes)

 

CodeColumn2Column3
US874932294Random dataRandom data
JI9237820283Random dataRandom data
IF8201827332Random dataRandom data
KS898720923Random dataRandom data
IK8297192902Random dataRandom data
OK092832910Random dataRandom data

 

And i am trying to create a field that can be used in the argument of the IN function so I don't have to write down 200 different codes.

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @AkisM 

 

You can use join tool like below.

 

Workflow:

atcodedog05_0-1634637256348.png

 

Hope this helps : )

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

If you are searching for text, I'd use a find replace tool and append the found term.  Then you can easily identify null versus the first term found as IN. 

cheers,

 

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
AkisM
10 - Fireball

Thanks to both for the suggested solutions, they do achieve the exact same thing as what I'm looking for, but just for the sake of curiosity, is it possible to do with the IN function as I'm describing? @MarqueeCrew @atcodedog05 

atcodedog05
22 - Nova
22 - Nova

Hi @AkisM 

 

Using IN no its not possible. Instead you can use contains like below. Which should the required action.

 

Contains([List], [Value])

 

atcodedog05_0-1634711545539.png

 

Hope this helps : )

 

Labels