Home : SQLRESULT
Q11307 - INFO: SQLRESULT

SQLRESULT returns a value located at Col and Row of an SQL Query result table. This SQL query must be specified using SQLFIRST formula and must be located in Spread Report cell referred to as Cell Reference.

SYNTAX:

SQLRESULT(SQLFirst_Cell, Col, Row)

SQLFirst_Cell: A cell reference (i.e. A1, B5...) to the cell that contains the SQLFIRST function.

Col: Column number to retrieve result from.  Col parameter can also be the field name from the query result in quotes (i.e. "TextResult")

Row: Row number to retrieve result from

NOTES:

Use Locate, SQL Results to build and locate SQLFIRST and SQLRESULT functions.

Be aware that SQLFIRST stores each query result table within memory. Use caution when specifying large MaxColumn and MaxRow sizes. Also, restrain from specifying queries that can potentially overwhelm your PC memory.

If you specify 0 for Col and Row parameters, SQLFIRST will perform the query, but it will not return anything. The result table of the query will be accessible by SQLRESULT.

 

EXAMPLES:

1)  A1 contains the following formula: SQLFIRST(1,1,””,"select max(curvalue), min(curvalue) from vardesc where varid=1",2,1)

 A2 contains the following formula:  SQLRESULT(A1,2,1)

The SQLRESULT refers to cell A1, which runs the query specified by SQLFIRST. The query is set to return 2  results (maximum and minimum). SQLFIRST in A1 only returns the maximum results. Hence SQLRESULT is A2 returns the minimum result.

2) Cell B1 contains the following formula: SQLFIRST(1,1,””,"select varnum,name,units  from vardesc where varid=1",2,1)

 Cell B2 contains the following formula: SQLRESULT(B1,"UNITS",1)

The SQLResult refers to cell B1, which runs the query specified by SQLFIRST and returns the units, or other specified info from the SQLFIRST query, where varid=1.  Returns value from the Units column, row 1. 

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 6/4/2008 9:25 AM.
Last Modified on 9/19/2008 3:21 PM.
Last Modified by Scott Dorner.
Article has been viewed 4639 times.
Rated 6 out of 10 based on 2 votes.
Print Article
Email Article