Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Database Reporting Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 17 2010 at 08:05 | IP Logged Quote GadgetGuy

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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: November 17 2010 at 08:36 | IP Logged Quote BeachBum

Mis-post...


Edited by BeachBum - November 17 2010 at 08:37


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

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 17 2010 at 09:14 | IP Logged Quote GadgetGuy

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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: November 17 2010 at 09:20 | IP Logged Quote BeachBum

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 View BeachBum's Profile Search for other posts by BeachBum
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 17 2010 at 13:10 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 17 2010 at 15:44 | IP Logged Quote GadgetGuy

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 View GadgetGuy's Profile Search for other posts by GadgetGuy
 

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