Welcome to WEAP's Website WEAP
WEAP is an initiative of the Stockholm Environment Institute.


About WEAP

Home
Why WEAP?
Features
What's New?
Sample Screens
Demonstration
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos (YouTube)

User Forum
Discussions
Members List
Edit Profile

Additional Support
Training
University Courses
Collaboration

About Us
SEI-US Water Resources Program
Please Contact Us

LEAP
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!
   

User Forum

All Topics | Topic ""If" inside an "if" function - How to write it?"
Log in to post new messages or reply to existing messages.
 
Author Message
Mrs. Érica Campos

Subject: "If" inside an "if" function - How to write it?   
Posted: 7/30/2020 Viewed: 6522 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

Mr. Jack Sieber

Subject: Re: "If" inside an "if" function - How to write it?   
Posted: 8/16/2020 Viewed: 6519 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

Mrs. Érica Campos

Subject: Re: "If" inside an "if" function - How to write it?   
Posted: 8/17/2020 Viewed: 6495 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?"