MYOB Exo Clarity

Hide NavigationShow Navigation

  • Contents
  • Index
  • Search
 
Display results with all search words

 

Events

You can control the functioning of a report in great detail by adding to code the events that fire at various points in the report generation process. Different parts of the report have different events - the available events for each part are described below.

Note: You can use the ShowMessage() function to see the order in which events fire. Enter ShowMessage('[Write the event name here]'); into the code pane of each event. A message box will then pop up when the event is fired.

Global Events

Events for the report as a whole can be edited at Global > Events when the Calc tab's tree view is set to "Module".

Event

Description

OnCreate

This event is triggered when the report is first created.

OnDestroy

This event is triggered when the report is closed.

Report Events

Events for the main report and each sub report can be edited on the Calc tab when the tree view is set to "Events".

Note: Events highlighted in blue are available for the main report and sub reports; all other events are available for the main report only.

Event

Description

AfterAutoSearchDialogCreate

This event fires after the Search window on the Preview tab has been created, but before it has been populated.

AfterEmail

This event fires after an email has been sent either programmatically from within the report or by selecting to send an email from the Print Preview window.

AfterOpenDataPipelines

This event fires after the report engine opens all of the data sources associated with the report, sub reports, and data-aware controls.

AfterPrint

This event fires after the print process has been completed. When printing to the printer or to the file, AfterPrint fires after the print job has been closed or after the file has been closed. When printing to the screen, AfterPrint fires after the Print Preview form has been closed.

BeforeAutoSearchDialogCreate

This event fires before the Search window on the Preview tab is created.

BeforeEmail

This event fires before an email has been sent either programmatically from within the report or by selecting to send an email from the Print Preview window.

BeforeOpenDataPipelines

This event fires before the report engine opens all of the data sources associated with the report, sub reports, and data-aware controls. You can use this event to apply custom parameter values to SQL or generate custom SQL.

BeforePrint

This event fires before the print process begins.

OnAssignPreviewFormSettings

This event fires before the Preview form settings are assigned to the Preview form. Provides the proper timing to assign them new values before they are transferred to the preview form.

You can use the OnPreviewFormCreate to control the Preview form's properties directly, as the OnPreviewFormCreate event fires after the settings have been transferred.

OnAutoSearchDialogClose

This event fires after the Search window on the Preview tab has been closed.

OnCancel

This event fires when the user cancels the print process.

OnCancelDialogClose

This event fires when the Cancel window is closed. This window is closed either when the user clicks the Cancel button, or when the printing process is complete. The Cancel window is only displayed when printing to the printer or to a file.

OnCancelDialogCreate

This event fires after the Cancel window has been created.

OnEndColumn

This event fires after a column has completed printing.

OnEndFirstPass

This event fires when the report has completed the first pass. You can save any grand totals or other calculated values at this point.

OnEndPage

This event fires after a page has completed printing. If you set DonePrinting to True in this event handler, no further pages will print.

OnEndSecondPass

This event fires after the report has completed the second pass. If you are taking manual control of the print process, and have variables which are no longer needed when the report is complete, you can clear them here.

OnFileDeviceCreate

This event fires after a FileDevice has been created - this is the object that is created when printing a report to a file.

OnGetAutoSearchParameters

This event fires when the report is generated, if AutoSearch values exist for the report.

OnInitializeParameters

This event fires whenever a report is generated. It occurs prior to the AutoSearch events. You can use this event to set parameters and AutoSearch values.

OnNoData

This event fires when no data is found by the data source connected to the report. This is used in some Exo Business reports and dashboard widgets to display a warning message if the user has selected parameters that return no data.

OnOutlineNodeCreate

When enabled, an outline tree structure is dynamically generated by the report engine and rendered by the report previewer. This event fires whenever an outline node is created during the report generation process. It can be used to customize the outline as it is being generated.

OnPageRequest

This event fires after the Print method has been called and all of the currently connected devices have been polled for the pages of the report that are needed. The result of this polling process is summarized into one PageRequest object, which is then passed to the report engine.

OnPreviewFormClose

This event fires after the Print Preview window has closed.

OnPreviewFormCreate

This event fires after the Print Preview window is created.

OnPrintFormClose

This event fires after the Print window has closed.

OnPrintFormCreate

This event fires after the Print window is created.

OnPrinterDeviceCreate

This event fires after a PrinterDevice has been created - this is the object that is created when printing a report to the printer.

OnPrinterDeviceStateChange

The PrinterDevice fires this event while sending pages to the printer.

OnSaveText

This event only fires when printing to a text file.

OnStartColumn

This event fires before a new column begins printing on the report.

OnStartFirstPass

This event fires when the report begins the first pass, when the report performs all calculations.

OnStartPage

This event fires before a new page begins printing on the report.

OnStartSecondPass

This event fires when the report begins the second pass, which formats and prints the report (if "Two Pass" is selected for the Pass Setting option in the Design tab's Report menu).

Report Band Events

These events are available for each report band that is in use. They are available on the Calc tab when the tree view is set to "Events".

Event

Description

AfterGenerate

This event is triggered after the band is printed. AfterGenerate differs from AfterPrint in that AfterPrint print fires every time a band has the opportunity to print. Sometimes the band has an opportunity to print, but for various reasons does not (usually printing on the next page instead.) In these cases, AfterPrint will fire, but AfterGenerate will not.

AfterPrint

This event fires after the band has printed.

BeforeGenerate

The BeforeGenerate event fires before the band prints. BeforeGenerate differs from BeforePrint in that BeforePrint fires every time a band has the opportunity to print. Sometimes the band has an opportunity to print, but for various reasons does not (usually printing on the next page instead.) In these cases, BeforePrint will fire, but BeforeGenerate will not.

BeforePrint

This event fires before a band begins printing. Use this event to perform actions before a band prints. One action is to control the visibility of objects which should or should not print in the band. This is the best event to use for setting the visibility of controls in a band.

OnCreateDrawCommand

This event fires each time the band prints on a page. You can use this event to add additional draw commands to the page.

Group Events

When a report uses grouping, you can edit events for each group on the Calc tab when the tree view is set to "Events":

Event

Description

AfterGroupBreak

This event fires before the report breaks for a group.

BeforeGroupBreak

This event fires after the report breaks for a group.

OnGetBreakValue

This event fires each time a group checks the break value (the value of the field that the report is grouped by).

OnGetEmailSettings

If the group's Email new fIle property is ticked on the Groups window, a new file will be exported and emailed each time a group break occurs (allowing you to email each group to a different recipient). This event fires each time a new file is created and emailed, and allows you to change the email settings for each group, e.g. specify different email addresses for each group.

OnGetFileSuffix

If the group's Create new fIle property is ticked on the Groups window, a new file will be exported each time a group break occurs. This event fires each time a new file is created.

Note: The Header and Footer bands for each group have the same events as the main Header and Footer bands.

Component Events

Each component that is placed on the report has events available for it. The events that are available different by the type of component - the most common events are detailed below.

Event

Description

OnCalc

This event applies to components like the Variable component, where a value is calculated. It fires after the calculation for the component has been performed.

OnDrawCommandClick

This event fires when the component is clicked on in the Print Preview window or the Preview tab.

OnDrawCommandCreate

This events fires when the component is drawn on the report.

OnGetMemo

This event applies to components like the Memo component, where a body of formatted text is displayed. It fires when the component is populated, but before it is drawn. You can use it to manipulate the contents of the component before it appears on the report.

OnGetText

This event applies to components that display plain text, such as labels and variables. It fires every time the component's text is referenced. You can use it to override the component's contents.

OnPrint

The OnPrint event fires before the component appears on the report ("print" can mean printing to a printer, exporting to a file, or appearing on the Print Preview window). Use the OnPrint event when you want to dynamically control the appearance of the report component, e.g. if you want to conditionally display a component by setting its Visible property at run-time based on some data field value.

Chart Events

Chart components have several events specific to them - these are discussed in Chart Events.