Define triggers
- Last Updated: December 22, 2023
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
The most basic way to define a trigger is to put the trigger definition directly into the object definition:
|
The TRIGGERS block in a DEFINE statement can contain
one or more individual trigger definitions, each starting with an ON
phrase naming the event followed by a single statement or a DO-END
block of statements. This form is called a definitional trigger.
If you use the AppBuilder to create your application procedures, it always creates separate blocks of executable code that attach triggers to objects at run time. This form is called a run-time trigger. There is no inherent advantage to one form over the other. Either way, the code in the trigger block is compiled and turned into r-code along with the rest of the procedure. You can use the AppBuilder to organize your trigger blocks to provide a more readable structure to your procedures.
The form of the trigger block for a run-time trigger names both the event and the object it applies to:
|
Either the event-name or the object-name (or both)
can be a comma-separated list. The statements can be either a single statement or a
DO-END block of statements.