Event scripts are called from various places in Stonefield Query. For example, just before the Login dialog is displayed, the Application.BeforeLogin script is called. When the user chooses the About Stonefield Query function from the Help menu, the About dialog calls the About.Settings script to fill its list of settings.

The following are the event scripts available in Stonefield Query:

Event order
At application startup, events fire in this order:

  1. Splash screen appears.

  2. Application.BeforeSetup

  3. DataEngine.AfterDataGroupsLoaded

  4. Reports Explorer window appears.

  5. GetDataSources scripts for any databases that have one.

  6. Application.BeforeLogin

  7. GetDataSources scripts for any databases that have one (executed a second time before the Login dialog appears)

  8. Login dialog appears.

  9. OpenDataSource scripts for any databases that have one.

  10. DataEngine.GetCustomMetaData

  11. Code in Setup.sqs if that file exists.

  12. DataEngine.AfterDataGroupsLoaded (executed a second time)

  13. Application.SetupMenu

  14. Application.AfterSetup

  15. ReportEngine.AfterGetFolders (may be executed multiple times: once for every expanded folder)

  16. ReportEngine.SetReportProperties (for the initially selected report)

  17. Reports appear in Reports Explorer.

  18. Application.ReportsExplorerActivated

  19. Application.ReportsExplorerReady

During a report run, events fire in this order:

  1. ReportEngine.BeforeRunReport

  2. Code in the BeforeData script for the report if there is any.

  3. DataEngine.BeforeCreateSQLStatement

  4. DataEngine.BeforeResultSetRetrieved

  5. DataEngine.FinalizeSQLStatement

  6. Select scripts for any tables that have one.

  7. DataEngine.BeforeSendSQLStatementToDatabase (only if there are some tables in the report that do not have a Select script)

  8. DataEngine.AfterResultSetRetrieved

  9. Code in the AfterData script for the report if there is any.

  10. ReportEngine.AfterReportPrepared

  11. ReportEngine.BeforeCreateFile (if the report is output to a file)

  12. ReportEngine.BeforeSendEmail (if the report is being emailed)

  13. ReportEngine.PreviewReport (if the report is being previewed)

  14. Code in the AfterRun script for the report if there is any.

  15. ReportEngine.AfterRunReport