We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

What is the best tool for this?

hi2019
8 - Asteroid

 

I have used Regex, Replace, Contains, and it is NOT working

 

I want it to flag all the ones that contain MULT

 

 

IF REGEX_Match([ID Codes], 'MULT') THEN '0' ELSE [Payee Name Count] ENDIF

 

 

thanks

5 REPLIES 5
Carolyn
12 - Quasar
12 - Quasar

Can you do a Contains instead of a RegEx_Match? I don't see a reason why that wouldn't work if your column ID Codes has "MULT" in it

 

IF Contains([ID Codes], 'MULT') THEN '0' ELSE [Payee Name Count] ENDIF

 

If that isn't working, can you provide some sample data?

 

Edit: Meant to add - use a Formula Tool

Raj
16 - Nebula

@hi2019 
use formula tool
if Contains([ID Codes], "MULT",1) then  '0' ELSE [Payee Name Count] ENDIF (make sure your field created is string)
[the last 1 is added to make it case sensitive , you can remove it if not required)

if Contains([ID Codes], "MULT") then  '0' ELSE [Payee Name Count] ENDIF
this should work
mark done if solved

hi2019
8 - Asteroid

its  not working- how could I use find and replace  t6ool-wouldnt that work?

Carolyn
12 - Quasar
12 - Quasar

@hi2019  What's not working/what's the error message?

 

You could make it work with F&P as long as the field is only "MULT". Otherwise, you'd end up with something like 

 

"WordsMULTWords" -> "Words0Words"

 

which I don't think is what you want...? 

Carolyn
12 - Quasar
12 - Quasar

@hi2019 - Is your issue that you're getting a message about something being a string when it shouldn't be, or a number when it shouldn't be? 

 

I'm noticing that you put the zero in single quotes, which will make it text. If your field is set to number format, that would cause an issue and could be what you're seeing. 

 

This is the formula with 0 being a number, not text. And, to be on the safe side, I threw a "tonumber" field onto the "else" clause

 

IF Contains([ID Codes], 'MULT') THEN 0 ELSE tonumber([Payee Name Count]) ENDIF

Labels
Top Solution Authors