About Event Triggers

An event trigger is a condition that causes an application event to fire, independent of anything that may be happening in the user interface. The event trigger carries a set of event trigger parameters for use when the application event fires.

An event trigger can be set to fire the application event only once, or can be set to retest for its condition after waiting a certain amount of time since either of these situations was true:

  • The trigger last successfully fired the application event.
  • The trigger last tested unsuccessfully for its condition.

In both cases, you can set the interval for the event trigger to wait, both for the successful firing of the trigger and for the unsuccessful test for the trigger conditions by using separate settings. Testing and retesting is accomplished by means of polling; this is not a true interruptive trigger.

An event trigger carries with it the user name and configuration in effect at the time it was defined. This data is passed on to the event state when the trigger fires the application event.

Each event trigger must contain a condition that consist one of these expressions:

  • A Boolean expression
  • Two non-Boolean expressions that are separated by a comparison operator

Examples

  • This example causes the application event to fire when seven days have elapsed since the current result of the database function dbo.LastEntryDate():

    DATEDIFF(day, DBFUNCTION("LastEntryDate"), CURDATETIME()) > 7

  • This example causes the application event to fire when the balance on a certain customer's order is greater than $10,000:

    DBFUNCTION("OrderBalance", GC(BigCustNum)) > 10000

  • This example causes the application event to fire on the first day of each month:

    DATEPART(day, CURDATETIME()) = 1

Note: The condition should generally involve a time operation, a database calculation, or both. This is because time and the database are the only known factors that can undergo change from external stimuli (that is, by the forward movement of time or by the actions of other application users, respectively).