Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: using SQL query in formula/macro Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
fasttimes
Groupie
Groupie


Joined: March 12 2006
Online Status: Offline
Posts: 63
Posted: March 21 2006 at 01:53 | IP Logged Quote fasttimes

How could I get the reults of the following query into some sort of array so I can use it in a formula or macro or even vbscript?

select id
from insteondevices
where location like '%kitchen%'

Is it possible to call a vbscript from a trigger?
Back to Top View fasttimes's Profile Search for other posts by fasttimes
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 21 2006 at 21:28 | IP Logged Quote dhoward

Yes, you can call a vbscript with the ph_runscript_? functions. Check out the help file as most of the ph_??? functions are also available for use within vbscript and jscript.

You can run SQL queries and iterate through the return results using the ph_sqlselect function (ph.sqlselect in vbscript). The syntax for your SQL above would be:

ph_sqlselect(1,"select id from insteondevices where location like '%kitchen%'")

ph_getsqlrows(1) will return how many records were retrieved and ph_getdata(1,row,1) will retrieve the data. Check out the help file under the Database section for more info and related functions. Be sure you destroy the data retrieval when you're done using the ph_sqldestroy(1) function to release the memory.

HTH,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

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