ph_sqlselectinto PowerHome formula function
Description
Executes a SQL query and returns the values of the first row into the appropriate LOCAL? system variables.
Syntax
ph_sqlselectinto ( n, s )
Argument |
Description |
n
|
The number of the starting LOCAL system variable to retrieve data into. This value must be between 1 and 10 inclusive. The first column of the SQL statement will be retrieved into the LOCAL system variable identified by n. Subsequent columns will be retrieved into subsequent LOCAL varaibles.
|
s
|
String representing a valid SQL statement. Multiple rows are allowed to be returned by the SQL select but only the first row as determined by the SQL order by will be returned.
|
Return value
Integer. Returns a 0 if successful. Returns 1 if n is outside of the range 1 to 10. Returns 2 if queries are against the REGINFO table. Returns 3 if the SQL is invalid. Returns 4 if an error occurs while creating the query.
Usage
Use this function to quickly retrieve data from the PowerHome database when you only need a single row of data. If you need to step thru multiple rows, use the ph_sqlselect function instead. If you declare a query that returns 3 columns and specify a value of 6 for n, then column 1 will go into LOCAL6, column 2 will go into LOCAL7, and column 3 will go into LOCAL8. If your query returns columns greater than what will fit into the LOCAL variables (LOCAL10 maximum), the extra columns will be discarded.