OnExecuteSqlStatementConstructed

The OnExecuteSqlStatementConstructed Event occurs just before SQL is sent to the Data Source to retrieve data for report execution. This Event could be used to inspect, log or modify the SQL that is being used for report execution.

Signature

For custom code the args array is structured as follows:

args[] contains a string representing the execution SQL in position zero.

For .Net Assemblies the method signature is as follows:

string EventHandlerName(SessionInfo sessionInfo, sting exectuionSql, SqlObject sqlObject)

Expected Return

The OnExecuteSqlStatementConstructed Event expects a string to be returned.

Example

The following example shows how report execution SQL can be written to a specified log file.

//Writes the current time, companyId, userId and report name to a specified log file.
File.WriteAllText(“C:\ReportSqlLogFile”, String.Format(“{0}, {1}, {2}, {3}”, DateTime.Now.ToString(), sessionInfo.CompanyId, sessionInfo.UserId, args[0]));
//returns null to proceed with execution
return args[0];