All Topics |
Topic: “"If" inside an "if" function - How to write it?”
Author | Message |
---|
Subject: "If" inside an "if" function - How to write it?
Posted: 7/30/2020 Viewed: 9825 times
I am trying to create an "if" function inside an "if" function, but just the first expression is working. How should I write it?
If(Year<2009; 500; (If(PrevTSValue(Supply and Resources\River\SF_CatchDM River\Reservoirs\Sobradinho DAM:Storage Volume[m^3]) < 22649; 200; 0)) Thank you! Érica |
Subject: Re: "If" inside an "if" function - How to write it?
Posted: 8/16/2020 Viewed: 9819 times
There is no problem in WEAP with nested If functions -- I'm not sure why it isn't working for you, although the expression you gave has unbalanced parentheses.
But in this case, you can use the extended form of WEAP's If function: If(TestExpression1, ResultIfTrue1, TestExpression2, ResultIfTrue2, ..., TestExpressionN, ResultIfTrueN, ResultIfAllFalse) Your expression would be: If(Year < 2009; 500; PrevTSValue(Supply and Resources\River\SF_CatchDM River\Reservoirs\Sobradinho DAM:Storage Volume[m^3]) < 22649; 200; 0) Jack |
Subject: Re: "If" inside an "if" function - How to write it?
Posted: 8/17/2020 Viewed: 9794 times
It worked as you said! So, WEAP assumes that I am inside an if function in every couple of data and I should not include the second "if", right?
Thank you very much! Érica |
Topic: “"If" inside an "if" function - How to write it?”