IF THEN ELSE statement

Use this forum to post Vensim related questions.
Post Reply
LBD
Member
Posts: 25
Joined: Wed Jan 25, 2006 7:56 pm

IF THEN ELSE statement

Post by LBD »

Is it possible to use the (:AND:) and/or (:OR:) in the 'IF' partof an IF THEN ELSE statement? I am getting errors. Please let me know. I cannot find much in the vensim manuals.

Thanks.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

This should work.

Param = IF THEN ELSE (
condition A = 1
:AND: condition B = 1
:AND: ( condition c = 1
:OR: condition D )
, result A
, result B )

All the best,

Tony.
LBD
Member
Posts: 25
Joined: Wed Jan 25, 2006 7:56 pm

Post by LBD »

I tried and I still get an error. I am attaching a file with the equation. Could you please take a look at it and let me know what the problem is?
Attachments
IF THEN ELSE.doc
(20.5 KiB) Downloaded 346 times
Lee Jones

Post by Lee Jones »

Two things;

1. "sum" is a reserved word in Vensim (a function acting on subscripts)

2. you cannot use the construct
"14 < client response<= 21"

you have to use

"client response >14 :AND: client response <=21"

Other than that, this is the most complicated nested if-then-else structure I have seen in 15 years, there may very well be a parenthesis problem in there too!


Good luck

Lee
LBD
Member
Posts: 25
Joined: Wed Jan 25, 2006 7:56 pm

Post by LBD »

Thank you.

I will try and play with the equation to fix the error.
Post Reply