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?
Solved! Go to Solution.
@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
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?
@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
Ah i understand now how the Formula tool works now, Thank you!!