The DataEngine.BeforeResultSetRetrieved script allows you to perform any necessary tasks just before the result set is retrieved from the database.

Parameters
A reference to the Stonefield Query Application object and the SQL statement Stonefield Query created for the report.

Return Value
True if the result set retrieval should continue or False if not.

Example
Suppose a report needs an additional calculation done before the result set is retrieved from the database. The result of this calculation could be stored in a property of the Application object that a Select script for a table uses.

Visual FoxPro

lparameters toApplication as SQApplication, tcSelect
local loDatabase as Database, lcSelect, llReturn
loDatabase = toApplication.DataEngine.Databases.GetMainDatabase()
lcSelect = 'select TAXRATE from CONSTANTS'
llReturn = not empty(loDatabase.ExecuteSQLStatement(lcSelect, ;
  '', 'CONSTANTS'))
if llReturn
  toApplication.AddProperty('TaxRate', CONSTANTS.TAXRATE)
endif
return llReturn

VBScript

function Main(Application, SelectStatement)
dim Database, XMLDOM
set Database = Application.DataEngine.Databases.GetMainDatabase()
SelectStmt = "select TAXRATE from CONSTANTS"
Results = Database.ExecuteSQLStatement(SelectStmt)
set XMLDOM = createobject("MSXML.DOMDocument")
XMLDOM.ASync = False
XMLDOM.LoadXML(Results)
TaxRate = XMLDOM.selectSingleNode("/DataSet/_resultset/taxrate").Text
Application.AddProperty("TaxRate", TaxRate)
Main = True
end function

JavaScript

function Main(Application, SelectStatement) {
var Database, SelectStmt, Results, XMLDOM, TaxRate ;
Database = Application.DataEngine.Databases.GetMainDatabase() ;
SelectStmt = 'select TAXRATE from CONSTANTS' ;
Results = Database.ExecuteSQLStatement(SelectStmt) ;
XMLDOM = new ActiveXObject('MSXML.DOMDocument') ;
XMLDOM.ASync = false ;
XMLDOM.LoadXML(Results) ;
TaxRate = XMLDOM.selectSingleNode('/DataSet/_resultset/taxrate').Text ;
Application.AddProperty('TaxRate', TaxRate) ;
return true ;
}

See Also
DataEngine Object | DataEngine.AfterResultSetRetrieved | Scripts