Summary

Visual LANSA

Summary

FRM105 - A Trigger Function

Important Observations

  • File triggers are a powerful technique for implementing common application logic.
  • Like all the other Repository techniques, using triggers will significantly simplify future system maintenance.
  • All LANSA application programs maintaining the file will run the trigger if required.
  • From V12, LANSA's Database Triggers enable non-LANSA programs to implement validation rules and triggers on LANSA-defined files

Tips & Techniques

  • Triggers are most efficient if they have an associated condition, meaning they are called only if required.
  • A triggers function returns the trigger list to the OAM. This means that 'After Read' triggers can be used to calculate an 'undefined' virtual field.

What You Should Know

  • As well as running common logic, such as this "send Email" example, triggers can calculate virtual fields or modify real fields, as used in this trigger example. Of course these require the trigger to be defined on the correct event, such as Before Update.
  • How to define a file level trigger and create and implement a file trigger function.
  • How to use the CASE / WHEN / ENDCASE and USE commands.