Once you have written your trigger subroutine, you must associate it with the appropriate Reality file using the CREATE-TRIGGER command. You must specify the file, the trigger subroutine and the type of trigger required (PRE-WRITE, POST-WRITE, PRE-DELETE or POST-DELETE). A trigger can be associated with a file data section or a file dictionary. Note that the trigger subroutine must be cataloged in the master dictionary of the account containing the file.
The DELETE-TRIGGER command allows you to remove trigger associations. In this case you need only specify the file name and the trigger type.
LIST-TRIGGERS lists the triggers associated with a file.
Notes:
The first time a trigger subroutine is used after you have logged on or associated it with a file, it is copied into a local cache. Subsequent calls to the trigger are therefore much quicker because it is not necessary to fetch the trigger from disk. The cache is cleared when you log off, log to another account or catalog any DataBasic program.
If the cataloged version is changed, only those processes that do not have the trigger cached will use the new version when the trigger next runs. Note that because the local cache is cleared when a DataBasic program is cataloged, the user that catalogs the new version of the trigger will use the new version immediately.
Embedded Basic Subroutines
How to Write an Embedded Basic Subroutine
Embedded Basic Examples
Debugging Embedded Basic Subroutines
Triggers Dos and Don’ts