dataEvent_record_OnSelectRows
Function called prior to running the query to populate a business record array. You can use this code event to customize the query used to select rows for a business record.
Syntax
PUBLIC FUNCTION dataEvent_record_OnSelectRows(
sqlSelect STRING,
sqlFrom STRING,
sqlWhere STRING,
sqlOrderBy STRING )
RETURNS (STRING)
The function has four parameter:
sqlSelect
is the SELECT clause of the SQL querysqlFrom
is the FROM clausesqlWhere
is the WHERE clausesqlOrderBy
is the ORDER BY clause.
Usage
When you select the On Select Rows property for the creation of the event, a function shell is created. Enter your code in the function.
This function is called immediately prior to filling a business array with the results of a
SELECT
statement. In this function, the SELECT
statement is
provided to the function in a string variable, and is returned to the program at the function
end.
Example: On Select Rows
This example uses the On Select Rows code event for the Account Report Data entity in the OfficeStore demo.
In this example, the value of the SELECT
statement is displayed to system
output.
PUBLIC FUNCTION dataEvent_Account_OnSelectRows(sqlSelect STRING, sqlFrom STRING,
sqlWhere STRING, sqlOrderBy STRING) RETURNS (STRING)
DEFINE sqlQuery STRING
LET sqlQuery = sqlSelect, " ", sqlFrom, " ", sqlWhere, " ", sqlOrderBy
CALL libdbappCore.log(C_LOG_INFO, "dataEvent_Account_OnSelectRows (Record scope) is raised")
DISPLAY "sqlQuery: ",sqlQuery
CALL libdbappCore.log(C_LOG_INFO, "dataEvent_Account_OnSelectRows (Record scope) is exited")
RETURN sqlQuery
END FUNCTION
For more information on the libdbappCore.log()
function,
go to DBAPPDEBUG and the debug level API.