Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Syntax error Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Mitch
Groupie
Groupie


Joined: September 26 2010
Online Status: Offline
Posts: 43
Posted: October 13 2010 at 12:17 | IP Logged Quote Mitch


My first attempt to write a PH formula:

if(ph_getx10stat(TESTX10) = 2,ph_insteon(RESET SYSTEM,19,0),ph_insteon(RESET SYSTEM,17,255))

I've tried changing a few things and keep getting a syntax error message. The goal is this:

If testx10 is on, then set reset system off, else set reset system on.

I'm sure it's something very simple/stupid that I am doing wrong.

Thanks for your help.

Mitch
Back to Top View Mitch's Profile Search for other posts by Mitch
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: October 13 2010 at 12:35 | IP Logged Quote BeachBum

This should work.

If (ph_getx10stat(“TESTX10”) = 2,ph_insteon("RESET SYSTEM”,19,0) , ph_insteon(“RESET SYSTEM”,17,255)


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Mitch
Groupie
Groupie


Joined: September 26 2010
Online Status: Offline
Posts: 43
Posted: October 13 2010 at 17:55 | IP Logged Quote Mitch


Ok - double quotes on the IDs - Thanks!

Back to Top View Mitch's Profile Search for other posts by Mitch
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: October 13 2010 at 18:10 | IP Logged Quote BeachBum

Typically strings have quotes around them. If I told you that it would have been too easy. Also remember you can’t use quotes within quotes. You would then use apostrophes.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Mitch
Groupie
Groupie


Joined: September 26 2010
Online Status: Offline
Posts: 43
Posted: October 14 2010 at 01:00 | IP Logged Quote Mitch


Ok, so it works, but it still gives me a 'formula error' in the event status bar. I can see the right things happening in the event log (no report of error), but the flash or red ERROR bugs me - what' up with that?
Back to Top View Mitch's Profile Search for other posts by Mitch
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 14 2010 at 08:15 | IP Logged Quote grif091

Generally where the formula has been entered you can double click to the Formula Builder. Each individual command in a complex statement can be executed to determine where the error is coming from. The posted example is missing a final trailing ) but that could just be a problem with the post and not the statement itself.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: October 14 2010 at 08:42 | IP Logged Quote BeachBum

Good catch Lee. When I tested it was right but when I posted I used Mitch’s post and modified it and didn’t correct the IF trailing paren.

Mitch, there is also a known glitch in this release that will cause an execution formula error when issuing some Insteon commands where in actuality there is no error.


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Mitch
Groupie
Groupie


Joined: September 26 2010
Online Status: Offline
Posts: 43
Posted: October 14 2010 at 23:07 | IP Logged Quote Mitch


Yes, I caught the missing paren. I think it may be a glitch in PH - when I do verify in formula builder I get this:

Execution time: 0.000 seconds.
     The formula evaluates to: 0

I think that means no errors?

Thanks!

Mitch
Back to Top View Mitch's Profile Search for other posts by Mitch
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: October 15 2010 at 08:14 | IP Logged Quote BeachBum

You’ve got it…   

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 

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