Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Expression Usage

BobjiK
8 - Asteroid

Can I use the below expression in the Formula Tool?

 

IF [System] = "1" or [System] = "2" THEN
[Owner] = "Brad Pitt"
ELSE [Owner] = [Primary]
ENDIF

 

Basically, I need to check if the field System is either 1 or 2, the field Owner must have the name "Brad Pitt" else, the field Owner must have the name in another field called Primary. 

 

Appreciate every help that I can get

6 REPLIES 6
geraldo
13 - Pulsar

@BobjiK 

 

 

in the formula tool add colunn called User and use the following formula
IF [System] = "1" or [System] = "2" THEN
"Brad Pitt"
ELSE [Primary]
ENDIF

BobjiK
8 - Asteroid

All the fields mentioned here are Strings. The above statement returns 0 against the field Owner.

geraldo
13 - Pulsar

@BobjiK 

 


your formula is wrong.
Owner must be the name of the column in the formula tool

 

check the formula I posted above

 

formula.JPG

BobjiK
8 - Asteroid

Hi @geraldo 

 

The below solution half works. I mean 

 

IF [System] = "1" or [System] = "2" THEN ==> This is not working as expected

 

whereas

 

IF [System] = "1" THEN ==> this works

 

Anyway I can make the 1st statement work?

 

By the way, I have already created a new column called Owner

geraldo
13 - Pulsar

@BobjiK 

 

It may have spaces, you have to clean it with Trim()

 

formula2.JPG

BobjiK
8 - Asteroid

Thanks @geraldo 

It worked like a charm

Labels