Author |
|
Lenny Senior Member
Joined: January 06 2008
Online Status: Offline Posts: 102
|
Posted: August 01 2019 at 08:10 | IP Logged
|
|
|
A long time ago I updated all my PH Formula's to use a "global formula". I came across one today that still was directly sending emails and I tried to update it and I can't seem to get the syntax correct. I attached the formulas in a text file since the forum tends to add spaces randomly to them.
The Global Formula is named "EMAILME"
ph_sendsmtpemailasync(0,"","smtp-server.domain.com",25,"Powe rHome Alert <HomeAlerts@somedomain.com>","me@mydomain.com",ph_getv ar_s(1,1),"Timestamp: " + string(today(),"yyyy-mm-dd hh:mm:ss.fff") + "~r~n~r~n" + ph_getvar_s(1,2))
Calling this formula this way works fine passing Formula, subject, and body
ph_formulabtnparm (1,"EMAILME","OVERHEAD DOOR OPEN!","VACATION MODE ACTIVE - OVERHEAD DOOR OPEN!",0,0,0)
As soon as I update the if condition with the new PH Function I get Syntax Error. Anyone see my mistake?
if ("{MODE}" = "VACATION" AND "{OHDSTATUS}" = "CLOSED", ph_formulabtnparm (1,"EMAILME","OVERHEAD DOOR OPEN!","VACATION MODE ACTIVE - OVERHEAD DOOR OPEN!",0,0,0),0)
2019-08-01_080956_formula.txt
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: August 01 2019 at 09:14 | IP Logged
|
|
|
Lenny,
The return value from the ph_formulabtnparm() function is a string (even if the ultimate result is a number). You need to make both the true and
false conditions evaluate to the same return type.
Changing your statement to this should make it work for you:
Code:
if ("{MODE}" = "VACATION" AND "{OHDSTATUS}" = "CLOSED", ph_formulabtnparm(1,"EMAILME","OVERHEAD DOOR OPEN!","VACATION MODE ACTIVE - OVERHEAD DOOR OPEN!",0,0,0),"") |
|
|
Hope this helps,
Dave.
Edited by dhoward - August 01 2019 at 09:15
|
Back to Top |
|
|
Lenny Senior Member
Joined: January 06 2008
Online Status: Offline Posts: 102
|
Posted: August 02 2019 at 08:08 | IP Logged
|
|
|
Dave,
Thanks for the explanation and quick response it works as expected.
Lenny
|
Back to Top |
|
|
|
|