Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Replace FALSE with a blank and true with an X

comckinley
5 - Atom

Hi all,

 

I have one input file and I am simply looking to do a replace all where in one column it says FALSE, I'd like for it to be blank or " ", and if TRUE then it says "X". I can easily do it in excel and assume I am just overlooking the method to do so in Alteryx as I must do this multiple times a day.

 

Thank you for any guidance!

7 REPLIES 7
jamielaird
14 - Magnetar

Hi @comckinley 

 

You can use a Formula tool as follows:

 

IF [Field] = "FALSE" THEN "" ELSE "X" ENDIF

 

This assumes that all the rows have a value of FALSE or TRUE and that the field has a string type.

 

If you want to be more explicit and return a null if the field didn't contain FALSE or TRUE use the following:

 

IF [Field] = "FALSE" THEN "" ELSEIF [Field] = "TRUE" THEN "X" ELSE Null() ENDIF

 

Have a play around with the Formula tool and I'm sure you will get the hang of it.

patrick_digan
17 - Castor
17 - Castor

@comckinley  Here are a few different options for your formula tool assuming your field is a string with either FALSE or TRUE

IF [Field] ="FALSE" Then "" Else "X" ENDIF

Replace(Replace([Field],"FALSE",""),"TRUE","X"))

 

comckinley
5 - Atom

Thank you so much!!

comckinley
5 - Atom

Thank you so much!

jamielaird
14 - Magnetar

You're welcome!

 

By the way, single or double quotation marks are both acceptable in the Formula tool. You don't even need to be consistent, other than making sure that you open and close each particular instance with the same style.

 

I'm pleased to see that @patrick_digan is in team double-quotation marks, which is obviously the best way.

patrick_digan
17 - Castor
17 - Castor

@jamielaird I'm very much on #TeamDoubleQuotes. It's admittedly less efficient than single quotes since I have to hit the shift key, but it's a habit that I can't break.

jamielaird
14 - Magnetar

@patrick_digan it's like our own version of tabs-versus-spaces

 

https://www.youtube.com/watch?v=SsoOG6ZeyUI

Labels