CREATE-TRIGGER

Associates a trigger with a Reality file.

Syntax

CREATE-TRIGGER file-specifier trigger-name trigger-type

Syntax Elements

file-specifier is 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
Run the trigger routine before writing a file item.

POST-WRITE
Run the trigger routine after writing a file item.

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 (see DELETE-TRIGGER).

Example

:CREATE-TRIGGER TF TRIG1 PRE-WRITE
[1901] 'PRE-WRITE' trigger added to file 'TF'.

See Also

DELETE-TRIGGER, LIST-TRIGGERS.

Go to top button