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

Environmental News
Ocean microplastics: First global view shows seasonal changes and sour...
An estimated 8 million tons of plastic trash enters the ocean each year, and most of it is battered by sun and waves int...

Cause, scope determined for deadly winter debris flow in Uttarakhand,...
The Uttarakhand region of India experienced a humanitarian tragedy on Feb. 7, 2021, when a wall of debris and water barr...

World-first discovery could fuel the new green ammonia economy
Scientists have developed a new technique using phosphonium salts that can help drive the future production of green amm...
Source: Science Daily
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: 1216 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: 1215 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: 1191 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?"