2 Replies Latest reply on Mar 15, 2016 2:19 PM by Rick Fernandez

# Syntax error, trying to combine two IF statements

Hi All,

Trying to figure out why my calculation below keeps giving me a "Syntax Error (maybe you are missing an operator)" error on my second IF statement.  Each calculation is valid on its own, but not when combining them.  Seems like I've tried everything.

Any assistance is appreciated.

Thanks,

Rick

• ###### 1. Re: Syntax error, trying to combine two IF statements

I assume the error is because there are multiple formulas in a single calculation returning multiple values.  Calculations can only return a single value, and in this case, it's being asked to return two separate values.  It looks like you're trying to return a single value of either '0', '1', the value of [Transfr to W].[Include], the value of [Transfr From W].[Include], the value of [Trnsfr B-W W].[Include], or 'REVIEW.'  If that's the case, the calculation will need to be rewritten to use further nesting of IF statements.  Something like this, maybe:

IF

ATTR([From Loc]) = ATTR([To Loc]) THEN '0'

ELSEIF

ATTR([To-From-Bet]) = "To" AND ATTR(STR[From Inv Adj)) = '1' THEN '0'

ELSEIF

ATTR([To-From-Bet]) = "To" AND ATTR(STR[From Inv Adj)) <> '1' THEN ATTR(STR[Trnsfr to W].[Include]))

ELSEIF

ATTR([To-From-Bet]) = 'From' THEN ATTR(STR[Trnsfr From W].[Include]))

ELSEIF

ATTR([To-From-Bet]) = 'Between' THEN ATTR(STR([Trnsfr B-W W].[Include]))

ELSE

'REVIEW'

END

• ###### 2. Re: Syntax error, trying to combine two IF statements

Great... that worked!  Thanks, Ryan...