Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Logical Operations Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 12 2010 at 09:17 | IP Logged Quote GadgetGuy

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 . . .
Code:
if(NOT{TEMP}>35,0,1)


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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: November 12 2010 at 10:15 | IP Logged Quote TonyNo

I can't find anything either. I'm guessing that I have been conditioned to work around this one. ;)
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 12 2010 at 11:03 | IP Logged Quote GadgetGuy

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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 12 2010 at 11:03 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 12 2010 at 16:08 | IP Logged Quote GadgetGuy

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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 13 2010 at 07:50 | IP Logged Quote GadgetGuy

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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum