Author |
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 12 2010 at 09:17 | IP Logged
|
|
|
I'm feeling very stupid about this, but can not find anything in the PH doco, nor in my extensive notes about how to NEGATE an expression.
That is if I want to make a decision if the temp is NOT greater than 35 degrees, there does not seem to be a "NOT" operator in PH such that I can say . . .
To keep the formula more understandable in use I don't want to use {TEMP}<=35
For the benefit of others looking for similar information let me state that PH does have an AND and an OR logical operator such that one can say . . .
Code:
if({TEMP}>35 AND {WIND}<15,1,0) |
|
|
which would produce a "1" when the temp was greater than 35 AND the wind was less than 15.
Thus I am surprised that there seems to be no NOT operator.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 12 2010 at 10:15 | IP Logged
|
|
|
I can't find anything either. I'm guessing that I have been conditioned to work around this one. ;)
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 12 2010 at 11:03 | IP Logged
|
|
|
David!
In the grand scheme of things, I can't believe you left this out, so it must be hidden somewhere!
Can you enlighten us?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 12 2010 at 11:03 | IP Logged
|
|
|
Heh, super simple...the not operator...is not .
1 = 1 when evaluated will equal true. To negate it, use:
not 1 = 1
This will now equal false. Of course, you may need to use parenthesis to clarify what is actually being negated.
Hope this helps,
Dave.
Edit....in your example above:
if(NOT{TEMP}>35,0,1)
this will almost work. It wont work because of how globals are substituted. If you change it to:
if(NOT {TEMP}>35,0,1)
add a space after not, it works.
Edited by dhoward - November 12 2010 at 11:23
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 12 2010 at 16:08 | IP Logged
|
|
|
Dave - THANKS!
I could not believe there was not a NOT! When I tried to use it I got a 'syntax error' so assumed that NOT was not valid. (Wow. Is that not a crazy sentence, or what?!)
It was as simple as the space needed. Geeze. It always seems to be that way. The fixes are so simple once one knows.
BTW - In the event new doco is produced at some time in the future, consider putting in a discussion about AND/OR/NOT and put them into the Help system too, as they are not present there now.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 13 2010 at 07:50 | IP Logged
|
|
|
GadgetGuy wrote:
When I tried to use it I got a 'syntax error' |
|
|
Dave - a thought for product improvement. I have run into this "Syntax Error" issue on many occasions and it has often fooled me into thinking I had a formula problem when in fact I did not.
The problem is that when one executes the Formula Check in the Formula Builder window, if one of the formula variables is a [LOCAL] or [TEMP], etc then it is undefined and when the formula is evaluated a Syntax Error result is produced.
In point of fact the formula does not have a Syntax Error, only the evaluated results do.
Is it possible to catch this and give a more accurate error comment such as "Undefined Variable" ?
This would really help debugging efforts.
Edited by GadgetGuy - November 13 2010 at 07:52
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|