Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Keeping field data constant instead of ending of with a Else Null statement

CM100
7 - Meteor

Hi Alteryx Community, 

 

Appreciate some help regarding this simple challenge 

Am currently stuck ending off with an ELSE NULL statement as append below

Would like to end off with ELSE "keep field value the same"  statement. In order to keep the field value the same if the above 2 ifs statement is not met. 

 

How would you go about ending the conditional statement

 

IF
Contains([Channel],"AGGREGATOR")
THEN "Aggregators"

ELSE IF
Contains([Channel], "AFFILIATES")
THEN "Partners and Affiliates"

ELSE Null()
ENDIF

 

Thanks in advance ! 

2 REPLIES 2
lmorrell
11 - Bolide

Hi @CM100 

 

This may seem counter-intuitive at first, but you will want to put in the same field that you are calculating on because IF statements cannot overwrite themselves. This is because IF statements are applied successively (More on this below). So in your case it will be: 

 

 

IF
Contains([Channel],"AGGREGATOR")
THEN "Aggregators"

ELSEIF
Contains([Channel], "AFFILIATES")
THEN "Partners and Affiliates"

ELSE [Channel]
ENDIF

 

 

We can think of an IF statement as checking if the logic is true (ie. Does the cell in the column "Channel" contain the word 'AGGREGATOR'?) and if the logic is true - then a formula will be applied. Then the next statement (ELSEIF) will be evaluated and applied successively until it reaches the ELSE statement. However, once a formula is applied - that value cannot be overwritten within the same IF statement.

 

This is the key for your scenario, because by overwriting your specified cells in "Channel" and then asking to overwrite values with "Channel" - this is ignoring the cells you have specified earlier in your formula. 

 

Hope this helps! 

CM100
7 - Meteor

It definitely helps !

Thanks for the detailed explanation 

Appreciate ! 

Labels