Free Trial

Alteryx Designer Desktop Discussions

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

What's the shortcut way to add multiple "OR" in a formula or filter?

vsheth312
5 - Atom

 

I have an input data in which I have one particular field like mentioned below:-

 

Project Name

New event

Offsite workshop

CEO fireside chat

 

I also have a list of 80 keywords which I want to check in the above-mentioned field whether those keywords are in the field or not.

I know one solution where I can use a filter tool and use contain a formula for all those 80 keywords but that will be a huge manual task to do as I have to write contains for each 80 words.

 

Is there any shortcut way to do the same?

 

Sample of the list of keywords

 

Event

Workshop

Fireside.

 

 

Please let me know if any further explanation is required.

 

 

Thank you in advance.

6 REPLIES 6
Mathias_Nielsen
9 - Comet

Hi, you can use a find and replace tool to check if any field contains the word. Then append the column and put a filter after that checks wether the column is empty or not :D 

Raj
16 - Nebula

@vsheth312 
you can use the "IN" function

[New event] IN ("Event","Workshop","Fireside")


hope this helps.



apathetichell
19 - Altair

Assumption is that this is not an exact match (or you'd use IN or a join to segregate out or in matches). so if you are looking for contains style search (or regex_match) - you can create a batch macro where you send your main datastream in - and your match terms becomes a control parameter. the control paramter values change your terms in your filter. you use a formula tool with a second action tool to flag which term was matched. and then you use an output data tool.

caltang
17 - Castor
17 - Castor

If you’re certain of the keywords and they don’t have many repetitions across - you can consider REGEX_CountMatches([YourField], “A|B|C|D”)

 

A B C D can be your keyword and the | is the OR statement. So you don’t have to write so many OR statements with CONTAINS. 

You can also explore the batch principle above by @apathetichell that utilizes the control parameter given a set of words. It then cycles through them and gives you what you need. 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
apathetichell
19 - Altair

Borrowed from @caltang - best way I can think of.

 

your match terms feed into a summarize tool. summarize tool concats them as configured here (basically to create a  list of .*{value0}.*|.*{value1}.*|.*{valueN}.* - this list is then appended to data stream. formula tool does regex_match from this list.

 

 

vsheth312
5 - Atom

Thanks, everyone for your input :)

Labels
Top Solution Authors