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:

  1. sqlSelect is the SELECT clause of the SQL query
  2. sqlFrom is the FROM clause
  3. sqlWhere is the WHERE clause
  4. sqlOrderBy is the ORDER BY clause.
It returns a string with the SQL query to fill a business record array.

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.