trgr:trigger-set-module( $trigger-name as xs:string, $module as element(trgr:module) ) as empty-sequence()
Sets or replaces the action module associated with the named trigger.
Parameters | |
---|---|
trigger-name | The trigger name. |
module | A module definition.
Use trgr:trigger-module
to construct this parameter.
|
When $trigger fires, $module is evaluated. Any module previously associated with $trigger is replaced when this function is called.
This function must be run in the context of the database containing the trigger to be modified.
If the named trigger does not exist, the exception
TRGR-TRIGGERDNE
is raised.
xquery version "1.0-ml"; import module namespace trgr="http://marklogic.com/xdmp/triggers" at "/MarkLogic/triggers.xqy"; (: Run in the context of the database containing the trigger :) trgr:trigger-set-module( "myTrigger", trgr:trigger-module( xdmp:database("trigger_module_database"), "/modules/", "the-new-action.xqy") ) => Empty sequence. When "myTrigger" fires, "the-new-action.xqy" is evaluated.