DataEngine.BeforeSendSQLStatementToDatabase allows customizing the SQL statement for a report, similar to DataEngine.FinalizeSQLStatement, but based on the current datasource when doing multi-datasource query. For example, you can add a WHERE clause to the SQL statement using something from the current data source. You can also determine if Stonefield Query split the query into several queries, one for each table (for example, if one of the tables is a virtual table or if the Stonefield Query Performs Joins configuration setting is True), by checking DataEngine.QuerySplit.

You can access the running report object through the global variable Report.

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

Return Value
The updated SQL statement or a blank string to not continue.

See also

DataEngine.FinalizeSQLStatement | Scripts

© Stonefield Software Inc., 2023 • Updated: 06/06/16
Comment or report problem with topic