Alteryx Designer Desktop Discussions

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

Replicating Contains formula into one string

wonka1234
10 - Fireball

Hi,

 

How can I replicate my contains formula into one line? I want to do this so I can use a text input and replace this string what an input.

 

Formula =  

If Contains([Value]), "Louis) or

Contains([Value]), "Ren") 

 

 

Is there a way I can make it something like

 

Formula =  Value Contains("Louis","Ren","Thomas")

 

thanks.

16 REPLIES 16
BS_THE_ANALYST
14 - Magnetar

@wonka1234 I like the idea of using the scary RegEx tool. It can do what you're looking for here! 

BS_THE_ANALYST_0-1675377756292.png

Just to explain the RegEx written: .*Louis.*|.*Ren.*|.*Thomas.*
.*Louis.* means, in the string, see if Louis is contained in it! 

the symbol | (known as the pipe). Means OR. i.e does the string contain Louis OR Ren OR Thomas. 

 

#ScaryRegex 😂.

 

One thing I will mention which is pretty cool. You can make it so it's case sensitive. I.e. Don't return TRUE if we see thomas, only if we see Thomas. Just untick the Case Insensitive box:

BS_THE_ANALYST_1-1675378134097.png

 

binuacs
20 - Arcturus

@alexnajm I updated the workflow to be dynamic

 

 

 

 

wonka1234
10 - Fireball

@BS_THE_ANALYST  Thanks!!! Do you know if there is a way to update these names using some interface tool?

wonka1234
10 - Fireball

@binuacs problem with this is - I wont know how many words a user wants to input. One may want 4 one may want 2.

wonka1234
10 - Fireball

@Felipe_Ribeir0 think this will work! is this case sensitive when searching?

Felipe_Ribeir0
16 - Nebula

Hi @wonka1234 

 

For the REGEX_CountMatches function you can add this third parameter:

0 => case sensitive

1 => non case sensitive

 

Felipe_Ribeir0_1-1675436093236.png

 

 

binuacs
20 - Arcturus

@wonka1234 I updated my workflow to accept any number of input. Can you test with your data?

 

binuacs_0-1675449413317.png

 

Labels