Loading TOC...

trgr:trigger-data-event

trgr:trigger-data-event(
   scope as element(),
   content as element(),
   when as element(trgr:when)
) as element(trgr:data-event)

Summary

Returns the XML representation of a triggering eventa, usable as the event parameter of trgr:create-trigger .

Parameters
scope An event scope, such as is created by trgr:directory-scope , trgr:collection-scope , or trgr:document-scope .
content An event part, such as is created by trgr:document-content , trgr:property-content , or trgr:any-property-content .
when The timing of the trigger execution (pre- or post-commit). Use trgr:post-commit or trgr:pre-commit to construct this element.

Usage Notes

The scope parameter describes the set of documents to which the trigger event applies. The content parameter describes the interesting activity within scope, such as document creation or document property modification. The when parameter describes when the event should be acted on, relative to the triggering transaction.

Example

xquery version "1.0-ml";
import module namespace trgr="http://marklogic.com/xdmp/triggers"
   at "/MarkLogic/triggers.xqy";

trgr:trigger-data-event(
  trgr:directory-scope("/myDir/", "1"),
  trgr:document-content("create"),
  trgr:post-commit()
)

  => A trigger event suitable for use with trgr:create-trigger.
     The triggering event occurs at post-commit whenever a document
     is created in the database directory "/myDir/".
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.