SET.TRIGGER

SET.TRIGGER

Top  Previous  Next

 

The SET.TRIGGER command sets, removes or displays the trigger function associated with a file.

 

 

Format

 

SET.TRIGGER file.name  function.name {modes}Set trigger function

 

SET.TRIGGER file.name ""Remove trigger function

 

SET.TRIGGER file.nameReport trigger function

 

where

 

file.nameis the file to be processed.

 

function.nameis the name of the catalogued trigger function. Maximum 32 characters.

 

modesis any combination of the following tokens indicating when the trigger will be executed.
PRE.WRITEBefore a write operation
PRE.DELETEBefore a delete operation
PRE.CLEARBefore a clear file operation
POST.WRITEAfter a write operation
POST.DELETEAfter a delete operation
POST.CLEARAfter a clear file operation
READAfter a read operation
ALLSets all of the modes listed above

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.

 

 

See also:

LIST.TRIGGERS