You are here: LANSA for i User Guide > Appendix C. Technical Notes > Trigger Functions > Exactly When Are Triggers Invoked?

Exactly When Are Triggers Invoked?

Before Open / Close

Before open/close triggers are invoked immediately before an attempt is made to open or close a file (or a view of it).

A before open trigger is invoked when a file or a view is opened and or another view has not already opened the file.

This means that if your logic is "Open View 1", then "Open View 2" (where view 1 and view 2 are both based on the same file) then the trigger would be invoked when you open view 1, but not when you open view 2.

A before close trigger is invoked when a file or a view is closed and another view still does not have the file open.

This means that if your logic is "Close View 1", then "Close View 2" (where view 1 and view 2 are both based on the same file) then the trigger would be invoked when you close view 2, but not when you closed view 1.

After Open / Close

Is invoked identically to the "before" options but immediately after a successful attempt has been made to close the file.

Before Read

Is invoked immediately before an attempt is made to read a record from a file. Before input triggers have no access to "information" from the file (because the information has not been input yet) so their use should be considered carefully. Access to the key(s) being used to access the file is not possible in this mode so do not design triggers based on this premise.

After Read

Is invoked after a record has been successfully read from a file and just before the details of the record are passed back to the invoking function. Any virtual field logic has been completed by this stage.

Before Insert

Is invoked immediately before an attempt is made to insert a new record into a file. Please note the following:

After Insert

Is invoked immediately after a new record has been inserted into a file. Please note the following:

Before Update

Is invoked immediately before an attempt is made to update an existing record in a file. Please note the following:

After Update

Is invoked immediately after an existing record has been updated in a file. Please note the following:

Before Delete

Is invoked immediately before an attempt is made to delete an existing record from a file. Please note the following:

After Delete

Is invoked immediately after an existing record has been deleted from a file. Please note the following: