Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Mulitple IF Statement Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Lenny
Senior Member
Senior Member


Joined: January 06 2008
Online Status: Offline
Posts: 102
Posted: May 23 2010 at 11:40 | IP Logged Quote Lenny


Maybe I'm not going around this the best way. I want to process code IF and only IF 2 GlobalVariables are TRUE.

So IF MODE=VACATION and OHDSTATUS=OPEN perform action.
I'm putting this in a single entry in my macro that updates keypad buttons for OHD Status since it's executed every time the state changes.

It seems to be ignoring the 1st IF anf processing it as true. Works fine with 1 IF.

/*VACATION MODE OVERHEAD DOOR ALARM*/

if("{MODE}" = "VACATION",if("{OHDSTATUS}" = "OPEN",ph_sendsmtpemail ("My.smtp-server.com", 25, "FROMeMail", "TOeMail", "OVERHEAD DOOR OPEN!", "VACATION MODE ACTIVE - OVERHEAD DOOR OPEN!"),0),0)
Back to Top View Lenny's Profile Search for other posts by Lenny
 
sjvonstein
Groupie
Groupie


Joined: February 05 2010
Location: United States
Online Status: Offline
Posts: 75
Posted: May 23 2010 at 12:20 | IP Logged Quote sjvonstein

Your ordering of the if statements appears to be correct. Are you receiving any formula syntax errors?
Back to Top View sjvonstein's Profile Search for other posts by sjvonstein
 
sjvonstein
Groupie
Groupie


Joined: February 05 2010
Location: United States
Online Status: Offline
Posts: 75
Posted: May 23 2010 at 12:32 | IP Logged Quote sjvonstein

*Deleted* See better suggestion below.

Edited by sjvonstein - May 23 2010 at 15:44
Back to Top View sjvonstein's Profile Search for other posts by sjvonstein
 
jbbtex
Senior Member
Senior Member


Joined: February 15 2007
Location: United States
Online Status: Offline
Posts: 181
Posted: May 23 2010 at 14:54 | IP Logged Quote jbbtex

So you want one action if both statements are true and
another action if either are false? Then try this way.

if("{MODE}" = "VACATION" AND "{OHDSTATUS}" =
"OPEN",ph_sendsmtpemail ("My.smtp-server.com", 25,
"FROMeMail", "TOeMail", "OVERHEAD DOOR OPEN!", "VACATION
MODE ACTIVE - OVERHEAD DOOR OPEN!"),0)


edit: removed extra ',0)'

Edited by jbbtex - May 23 2010 at 21:12


__________________
Brady

"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." - Gen. George S. Patton
Back to Top View jbbtex's Profile Search for other posts by jbbtex
 
Lenny
Senior Member
Senior Member


Joined: January 06 2008
Online Status: Offline
Posts: 102
Posted: May 23 2010 at 19:16 | IP Logged Quote Lenny

jbbtex wrote:
So you want one action if both statements are true and
another action if either are false? Then try this way.

if("{MODE}" = "VACATION" AND "{OHDSTATUS}" =
"OPEN",ph_sendsmtpemail ("My.smtp-server.com", 25,
"FROMeMail", "TOeMail", "OVERHEAD DOOR OPEN!", "VACATION
MODE ACTIVE - OVERHEAD DOOR OPEN!"),0),0)


Doh, now I feel dumb :) I was thinking If/If or If/Then... Changing to single IF with AND operator and removing the last ,0 it works as it should.
Thanks so much



Edited by Lenny - May 23 2010 at 19:18
Back to Top View Lenny's Profile Search for other posts by Lenny
 

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