Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Check out our powerful new search update! You can read more here. Please let us know if you have any feedback by creating a topic here.
SOLVED

Replace FALSE with a blank and true with an X

Highlighted

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!

Highlighted
Alteryx Certified Partner

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.

Highlighted

@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"))

 

Highlighted

Thank you so much!!

Highlighted

Thank you so much!

Highlighted
Alteryx Certified Partner

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.

Highlighted

@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.

Highlighted
Alteryx Certified Partner

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

 

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

Labels