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
Solved! Go to Solution.
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.
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
Worked perfect - thanks!