Author |
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 17 2010 at 08:05 | IP Logged
|
|
|
Now that the power of the database filtering has become more apparent, I'm wondering if that functionality can be extended a bit.
The PH "Reports>Database Where Used" feature only locates the use of a Global variable in cases where it is defined in a macro.
I have a major variable {HOME} used throughout my automation to indicate when the house is occupied (set when motion is detected). I want to change how it is used and need to find all the places it has been used in a formula in the SEND KEYS field.
Is there a (SQL?) way to find all occurances of this global's use, or even of the word "HOME" which would work too?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: November 17 2010 at 08:36 | IP Logged
|
|
|
Mis-post...
Edited by BeachBum - November 17 2010 at 08:37
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 17 2010 at 09:14 | IP Logged
|
|
|
Pete - not sure what "mis-post" means.
I'm looking for a PH Script Editor (SQL Mode) way to retrieve all uses (definitions or use) of a variable. I figured the "Programming" section here was the best location for this inquiry.
Should this be somewhere else?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: November 17 2010 at 09:20 | IP Logged
|
|
|
I opened my mouth before reading the complete detail so I deleted the post. Really don’t have an answer to your question.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 17 2010 at 13:10 | IP Logged
|
|
|
Ken,
The "Database Where Used" report should be able to handle your request without problem. It basically does all the heavy SQL lifting for you by searching nearly all of the PowerHome tables (global var, macro, trigger, formulas, etc) for a specific keyword.
Since you have a global variable with an ID of HOME, just put:
%HOME%
in the where used search string and it will search all the tables for that wildcarded string. This will return all instances where you have used the string HOME (not just global variables). This could include a device with a label of "HOME LIGHTS", a trigger containing the word HOME in the ID, the boolean, the Action, etc., or macros, etc. Obviously, by adjusting the search string and the use of wildcard characters will control what you get back. If you're only interested in the exact global variable substitution string {HOME}, then you could search using %{HOME}%. The more general from of %HOME% will obviously return the instances where you may have used the form of: ph_getglobal_s("HOME").
Hope this helps,
Dave.
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: November 17 2010 at 15:44 | IP Logged
|
|
|
David - you NEVER cease to amaze me!
That was exactly what I needed. I found all the instances and was able to quickly get the modifications installed that I wanted.
I never thought of using the wildcard "%" character to open up the search. My method was only finding the ID use of the term and not the general formula useages.
Great new piece of knowledge to have under the belt.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|