MarkLogic 10 Product Documentation
trgr:trigger-set-module

trgr:trigger-set-module(
   $trigger-name as xs:string,
   $module as element(trgr:module)
) as empty-sequence()

Summary

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.

Usage Notes

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.

Example

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.
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy