Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

[ Image Removed |../../index.htm#lansa/ladtgubh_0180.htm]
You are here:

...

To define a function as being a trigger function, use the TRIGGER parameter on the FUNCTION command.
If the function is to act as a data dictionary level trigger, enter *FIELD into the first part of the parameter, and the associated data dictionary field name into the second part of the parameter.
If the function is to act as a database level trigger, enter *FILE into the first part of the parameter, and the associated database file name into the second part of the parameter. The file specified must be a physical file.
As an aid to defining new trigger functions LANSA is shipped with the following Application Templates that can be used to form the base of a trigger function:

BBFLDTRIG

Field Level Trigger Function

BBFILTRIG

File Level Trigger Function

When a function is defined as a trigger function you must follow these guidelines:

...

  • Understand how triggers are defined and how they should be used by reading the Field Rules/triggers sections and Trigger Functions section.
  • Use options *NOMESSAGES and *MLOPTIMIZE.
  • Options *HEAVYUSAGE and *DBOPTIMIZE may also be considered.
  • Do not directly or indirectly access the database file that the trigger is, or will be, linked to.
  • Where triggers are heavily and constantly invoked avoid resource intensive operations. Such operations will slow down access to the associated file. Whenever reasonable make the trigger "submit" another transaction thus not delaying the source of the event significantly.
  • Recursive implementations may be defined, but will fail to execute correctly. For instance a field trigger function invoked during an insert to file A could attempt to insert data into file B, possibly causing itself to be invoked in a recursive situation, and thus to fail.

...