Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

Nested If then statement

Highlighted
7 - Meteor

How should this nested if then statement be formed? I'm getting a malformed if statement error. 

 

I'm trying to identify If [PURITY_PROD_CD] = "CRD"

 

If it is not "CRD" then [Correct Risk Open Volume]=[SIGN_PRICED_VOL]

 

If it is "CRD" then

 

if [PRICE] != 0

 

then 

 

[Correct Risk Open Volume]=[SIGN_PRICED_VOL]

 

else

 

[Correct Risk Open Volume]=0

 

crtakacs_0-1598478032447.png

 

 

 

Highlighted
11 - Bolide

Is this what you are looking for...

 

If [PURITY_PROD_CD] = "CRD" THEN
   IF [PRICE] != 0 THEN
       [SIGNED_PRICE_VOLD]
  ELSE
      0
   ENDIF
ELSE
     [SIGNED_PRICE_VOLD]
ENDIF

 

You don't need to include the new field name, when updating the values, so just have [SIGN_PRICED_VOL] instead of [Correct Risk Open Volume]= [SIGN_PRICED_VOL]

 

I hope that helps.

 

 

 

 

Highlighted
13 - Pulsar
13 - Pulsar

Hi @crtakacs,

 

The format for Alteryx is IF...THEN...ELSEIF...THEN... ELSE... ENDIF   Your syntax and order need to be shifted around.

 

Try:  

 

IF [PURITY_PROD_CD] != "CRD" THEN [Correct Risk Open Volume] = [SIGN_PRICED_VOL] ELSEIF [PRICE] != 0 THEN  [Correct Risk Open Volume]=[SIGN_PRICED_VOL] ELSE [Correct Risk Open Volume]=0 ENDIF

 

This looks first for not equal to CRD for the first if, then looks at price to split the remainder.

 

 

 

else

 

[Correct Risk Open Volume]=0

Highlighted
7 - Meteor

Worked perfect - thanks! 

Labels