Hello All,
I am trying to add new logic to the existing Alteryx workflow formulae. Could anyone please assist in how I add new logic?
Existing Formula
IF IsEmpty([Line type])
THENIF Contains([Order Type], "BILL") THEN "BILL"
ELSE "NEW" ENDIF ELSE [Line type] ENDIF
I am trying to add new categories in THENIF Contains([Line Type] like Internal, Trial, Return
Example - IF IsEmpty([Line type])
THENIF Contains([Order Type], "BILL") THEN "BILL" OR Contains([Order Type], "Return") THEN "Return"
ELSE "NEW" ENDIF ELSE [line type] ENDIF
Thanks,
Solved! Go to Solution.
Hi @Learner09,
You'll want to use an AND condition for where you have multiple conditions. The IF statement works in three main steps
(1) IF - Initial condition to test for
(2) THEN - What happens if that is true?
(3) OPTIONAL ELSEIF - If you have further conditions to test for
(4) OPTIONAL THEN - If you are testing for further conditions in step (3) you return this result
(5) ELSE - If none of the above is true return this result
(6) END - Finish IF statement
You example in this case would look something like the below:
IF (IsEmpty([Line type]) AND Contains([Order Type], "BILL")) THEN "BILL" ELSEIF Contains([Order Type], "Return") THEN "Return"
ELSE "NEW" ENDIF
Kind regards,
Jonathan
Based on what I think your formula is doing, I would turn it around to get the non-empty Line type out of the way first. Then just add as many ELSEIF clauses as you need, e.g.
IF !IsEmpty([Line type]) THEN [Line type]
ELSEIF Contains([Order Type], "BILL") THEN "BILL"
ELSEIF Contains([Order Type], "Return") THEN "Return"
ELSE "NEW" ENDIF
Thank you @Jonathan-Sherman
No problem at all @Learner09!