CREATE-TRIGGER
Associates a trigger with a Reality file.
Syntax
CREATE-TRIGGER file-specifier trigger-name trigger-type
Syntax elements
file-specifier The name of the file with which the trigger will be associated. This can be a file data section, a file dictionary, or an account's master dictionary.
trigger-name The name of the trigger subroutine. This must be a cataloged DataBasic subroutine in the MD of the account containing the file.
trigger-type The type of trigger - one of the following:
WRITE or PRE-WRITE
Runs the trigger routine before writing a file item.
POST-WRITE
Runs the trigger routine after writing a file item.
READ or PRE-READ
Runs the trigger routine before reading an item from the file.
POST-READ
Runs the trigger routine after reading an item from the file.
CLEAR or PRE-CLEAR-FILE
Runs the trigger routine before a CLEAR-FILE operation on a file data section.
POST-CLEAR-FILE
Runs the trigger routine after a CLEAR-FILE operation on a file data section.
DELETE-FILE or PRE-DELETE-FILE
Runs the trigger routine before a DELETE-FILE operation on a file dictionary or data section.
POST-DELETE-FILE
Runs the trigger routine after a DELETE-FILE operation on a file dictionary or data section.
DELETE or PRE-DELETE
Run the trigger routine before deleting an item from the file.
POST-DELETE
Run the trigger routine after deleting an item from the file.
Restrictions
Requires SYS2 privileges.
Comments
The file specified may be a local file (dictionary or data section) or the master dictionary of an account. You cannot specify a Q-pointer.
When associating a new trigger with a file, any existing trigger of the specified type must first be deleted. DELETE-TRIGGER file-specifier * will remove all triggers from a file.
Example
:CREATE-TRIGGER TF TRIG1 PRE-WRITE
[1901] 'PRE-WRITE' trigger added to file 'TF'.