Author |
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: October 09 2006 at 02:59 | IP Logged
|
|
|
I'm having a tough time figuring out the formula builder. I double click on a formula field, edit an existing formula, Click on 'Close', then press 'F5'. Sometimes the changes are saved, but most of the time it reverts to the pre-edit state.
What am I doing wrong?
When do I need to press F5?
Do I need to press F5 at all?
Do I need to wait a specific amount of time after exiting the formula builder before I do something else?
Is it okay to have a different command on each line? That didn't seem to work for me, so I used the + sign instead.
Thanks,
Cris
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: October 09 2006 at 03:09 | IP Logged
|
|
|
I don't get this! If it makes a difference, this is in the 'triggers' section with 'raw formula' selected. If I double click on the formula, highlight everything and delete it, close the formula builder, click on another trigger, the original formula field is blank. If I click on another tab, say 'setup' in PH explorer, then return to the triggers area, the formula has returned. Same thing happens if I press F5 instead of moving off of the 'triggers' page.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: October 09 2006 at 14:15 | IP Logged
|
|
|
Cris,
Im not sure what is causing your problem. I just tried to duplicate here and was unable. It would probably be best if you post the actual formula as it may be something in the text itself that PowerHome is hanging up on.
F5 is just a shortcut key for "Refresh". Whenever you refresh, PowerHome does an automatic "Save" to the database. As you work in the Explorer, you're essentially making changes in memory. These changes are not saved permanent to the database unless the screen is changed (such as moving from Triggers to Setup), you refresh, or you shutdown the Explorer. Other saves are done automatically in various places depending upon where you are such as hitting "Play" in the Macro Detail screen. Generally, you don't have to press F5 unless you want to Save your changes immediately for some specific reason (such as to check if the syntax is legal, etc.)
One thing about a formula though is that they typically are all on a single line. You cant put separate functions on separate lines. They must be separated with a "+" sign or other operator since a formula is really just a mathematical operation. You can use line breaks to help in readability in the Formula Builder (it may actually be more difficult in the Explorer because the formula will typically only show the first line) but you must still use the appropriate mathematical operators in order for the formula to evaluate properly.
Dave.
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: October 09 2006 at 15:16 | IP Logged
|
|
|
Dave,
Thanks for the reply. My power briefly went off last night and when I woke up this morning I tried again, and this time the 'save' stuck. This save issue has happened before, but I haven't been able to pick up a pattern. I'm sure it's probably something I'm doing wrong. The specific steps I was taking was editing an existing trigger in explorer. I would double click the 'action' field which held a formula, make changes in the formula builder, hit 'close', then either hit 'F5' or change to the GV page in explorer. For example, below I was ph_setglobal_s in the last part of the formula. That didn't work so I would go into the FB, change the _s to _a, hit close, then hit 'F5', then go hit the light switch to trigger, then check the GV to see if it had changed. The GV didn't change and when I went back to the trigger, the formula had reverted to ph_setglobal_s
Will the formula automatically undo changes if those changes don't result in a valid formula?
Is there a way to 'simulate' a trigger - without going to push the light switch to test it?
Here is the formula:
ph_setglobal_s("DEVLOGNAME","OFFICE LIGHTS EAST") +
ph_setglobal_s("DEVLOGCOMMAND","ON") +
ph_setglobal_a("DEVLEVEL", ph_getinsteonlevel("OFE"))
Thanks for your help,
Cris
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: October 09 2006 at 16:16 | IP Logged
|
|
|
I believe I have requested trigger simulations before, so thanks for speaking up.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: October 10 2006 at 13:23 | IP Logged
|
|
|
Cris,
Im not sure what was causing the problem. Usually what happens is if something in the data is keeping it from being saved, you'll get a window popping up saying that it was uable to save the changes, some SQL saying what the problem was and a couple of buttons asking if you want to continue anyway (OK) or try to fix (Cancel). Let me know if it happens again and any info that you think might be pertinent. I'd like to try and track it down.
A valid formula is not checked for at "Save" time and PowerHome would only know if the formula was valid or not at execution time (when it is evaluated). What would cause a problem and keep changes from being saved would be a primary key violation (duplicate ID values), null values (blanks) in not null fields (Description fields cannot be blank). Usually a formula wouldnt keep a save from happening unless something about the data was not within SQL guidelines.
The formula you've posted looks fine, btw. You're calling three functions formed together in a proper mathematical formula and the result should be 0 if every function works properly.
Depending upon what you're trying to test, you could just right-click the "Action" column and select "Check Formula". This will just evaluate the formula which may or may not work properly depending upon the actual formula. In the above formula, you should have no problem. If the formula contained LOCAL or TEMP variables which were dependant upon the trigger itself, then it may not work as expected.
There is also a fairly recent function ph_checktrigger. This will actually allow you to generate the conditions which would cause a trigger (or triggers) to fire. I admit it's not documented very well (Im sure you could figure it out Tony ). If you tell me the type of trigger and the trigger ID, trigger number, trigger values in the trigger, I can supply you with the appropriate syntax.
Dave.
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: October 11 2006 at 16:25 | IP Logged
|
|
|
I just discovered a possible explanation for this behavior. I may have had multiple Powerhome Explorer windows open and was unknowingly switching between them. I leave PH on all the time, and lately the Insteon explorer has covered all other windows. Multiple explorer windows overlap exactly on top of one another, and I think I was jumping between 2 or more of them.
On the other hand, I just tried to duplicate the behavior and could not...
|
Back to Top |
|
|
|
|