The SET.TRIGGER command sets, removes or displays the trigger function associated with a file.
If no modes are specified, the default is PRE.WRITE and PRE.DELETE.
The first form of the SET.TRIGGER command sets the name of the trigger function to be associated with the named file. Any existing trigger function is replaced by this action.
The second form of the SET.TRIGGER command removes the trigger function for the named file.
The third form of the SET.TRIGGER command displays the name and modes of the trigger function for the named file.
Setting or removing a trigger while the file is open may not take effect until after the next access to the file. For directory files, a change to the trigger will only take effect when the file is next opened.
A trigger function on a hashed file will be called by all updates to the file in the modes for which the trigger is active. A trigger function on a directory file will be called only by updates from within QM and not for use of sequential file operations (WRITESEQ, WRITEBLK, etc), OSWRITE or OSDELETE. Some implications of this are that query processor CSV or delimited reports directed to a file and QMBasic compiler listing files will not call the trigger function.