Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Nested If Else Then

SiddhantSurve
6 - Meteoroid

Can someone please help with the logic to get rid of the error  : MALFORMED IF STATEMENT

 

 

if contains(uppercase([Parent Product]),"x") then 1
elseif contains(uppercase([Parent Product]),"y") then 2
elseif contains(uppercase([Parent Product]),"z") then 3
elseif contains(uppercase([Parent Product]),"a") then 4
elseif contains(uppercase([Parent Product]),"b") then
if contains([Child Product],"Sample") then 5 else 6
endif

1 REPLY 1
estherb47
15 - Aurora
15 - Aurora

Hi @SiddhantSurve ,

 

The challenge here is that you're opening up a new IF without closing it, or your last if should be an ELSEIF

 

To wit:
if contains(uppercase([Parent Product]),"x") then 1
elseif contains(uppercase([Parent Product]),"y") then 2
elseif contains(uppercase([Parent Product]),"z") then 3
elseif contains(uppercase([Parent Product]),"a") then 4
elseif contains(uppercase([Parent Product]),"b") then
ELSEIF contains([Child Product],"Sample") then 5

else 6
endif

OR:

if contains(uppercase([Parent Product]),"x") then 1
elseif contains(uppercase([Parent Product]),"y") then 2
elseif contains(uppercase([Parent Product]),"z") then 3
elseif contains(uppercase([Parent Product]),"a") then 4
elseif contains(uppercase([Parent Product]),"b") then

     IF contains([Child Product],"Sample") then 5 else 6
     ENDIF

ELSE 6
endif

Labels
Top Solution Authors