Page 1 of 1

logical operators

Posted: Mon Aug 04, 2008 11:55 am
by Danny
I have a problem with an IF THEN ELSE function.
The function is the following:
measure= IF THEN ELSE (threshold1>=value1 :OR: threshold2>=value2 :OR: threshold3>=value3, 100, 0)

There is a problem with the logical operators. I want to express that, if one or more of the thresholds are reached or exceeded, measure turns 0. But it doesn't work.
Is it not possible to include :OR: in an IF THEN ELSE function? Probably I need to include :AND: somehow to state that the IF conditions can also happen in combination. :AND: or :NOT: are included in the Users Guide (as examples), so I expected :OR: to work as well...?

Danny

Posted: Mon Aug 04, 2008 12:05 pm
by bob@vensim.com
The expression you have is valid and will return 100 if any one of the thresholds exceeds the value, otherwise it will return 0. Thus the way you have it all thresholds need to be exceeded to get 0. To get what you want you would use

IF THEN ELSE(value1 >= threshold1 :OR: value2 >= theshold2 :OR: value3 >= threshold3,0,100)

Posted: Mon Aug 04, 2008 1:43 pm
by Danny
Thank you. Of course it works now.
Sorry for that stupid question, but I've just gone blank with this problem.

Thanks for the help,
Danny