Alteryx Designer Desktop Discussions

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

Unexpected output

jakemiroquai
7 - Meteor

Hi, I am currently trying to use an IF condition to output values such as '1' or '0' but instead, I am getting '-1' in output files. Does anyone know why?

4 REPLIES 4
binuacs
21 - Polaris

@jakemiroquai your IF statement is not correct in the second field. You cannot check conditions in the ELSE part, it should be a static value

IF [STATUS]= 'IF' THEN 1

ELSE Null()

ENDIF

jakemiroquai
7 - Meteor

Hi there, thank you for your prompt response. I realised my mistake there but can confirm that when i'm writing "THEN '1'", its assigning to the new column I have created, yes? Additionally, is there a way I can assign a value to a different column if the condition is fulfiled? Like what I intended to do in the first place?

binuacs
21 - Polaris

@jakemiroquai Yes it will assign 1 to the new column, you cannot assign a value to a different column when the condition is met as you mentioned in your if statement.

 

one option is you write the formula in two sections like below

INIT_POLS_IF

---------------------

IF [STATUS] = 'IF' THEN '1' ELSE Null() ENDIF

 

SPOCDE

----------------------

IF ISNULL([INIT_POL_IF] ) THEN '1002' ELSE [SPCODE] ENDIF

jakemiroquai
7 - Meteor

Ah i understand now how the Formula tool works now, Thank you!!

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels