Triggers (datrg1100m000)

Use this session to add, update or delete triggers.

To define a trigger:

  1. Specify the trigger properties, such as the Path for Program, Condition Template and Action Template. See the field help for detailed information on these properties.
  2. If any condition must be used, run the Configure Conditions... command to define the trigger condition. Depending on the selected Condition Template, you must enter a condition script, in Baan C code, through a text editor. Or you can specify the condition in a session. See the field help of the Condition Template field.
  3. Run the Configure Actions... command to define the action that the trigger must take. Depending on the selected Action Template, you must enter a script, in Baan C code, through a text editor, or configure the action through a session. See the field help of the Action Template field.
Note: The trigger program, library object, is generated automatically. When you delete a trigger, the trigger's runtime files are also deleted.

When you add or update a trigger, you must specify the Path for Program. When you set or change the path, you are asked whether the system must create it, if it does not yet exist. When you change the path, the trigger's runtime files are moved to the new directory.

When you copy a trigger, the configuration settings are also duplicated.

RUNTIME COMPONENTS

At runtime, the trigger logic is stored in a library object in the file system. This object is generated from the trigger configuration and is stored in the directory that is specified in the Path for Program field.

These files can be generated:

  • <trigger>.src, containing the generated source
  • <trigger>.bak, containing the previously generated source if an existing source is regenerated
  • <trigger>.dll, containing the compiled object
  • <trigger>.err, containing compilation errors if any

When you add a new trigger, empty runtime files are generated immediately. When you change the action or conditions, the library source and object are (re)generated automatically.

During (re)generation, this happens:

  • The <trigger>.src file, if existing, is moved to <trigger>.bak.
  • A new <trigger>.src file is generated based on the actions and conditions.
  • The source file <trigger>.src is compiled into an object <trigger>.dll. If an error occurred, the <trigger>.err file contains the compilation errors and warnings.

Actions/Reference menu

These options are available:

Configure Conditions

Use this command to define the trigger condition. Depending on the selected Condition Template you must configure the condition in a text editor or in a session.

Configure Actions

Use this command to define the action that the trigger must take. Depending on the selected Action Template you must configure the action in a text editor or in a session.

Generate Program

Use this command to explicitly regenerate the trigger's runtime components when the conditions or action settings are not changed.

Usually this command is not used, because in most situations the generation is done automatically. It can be required, for example, when the generation failed. This happens when the trigger's runtime files could not be written to the directory that is specified in the Path for Program field. For more information, see RUNTIME COMPONENTS.

Field Information

Trigger

An identification of the trigger. You can use a logical name.

Description

A description of the trigger. Filling in this field is optional.

Path for Program

The directory that contains the trigger's runtime library that is generated.

When you change the path, the trigger's runtime files are removed and new runtime files are generated in the new directory. Refer to RUNTIME COMPONENTS for more information.

Filling this field is mandatory.

Condition Template

The condition template determines how a condition is configured.

Select one of the following condition templates from the drop-down list box:

  • None:

    no condition needs to be checked; all incoming trigger events are processed.
  • Attached Script:

    the condition is coded in a text (condition script) that is attached to the trigger. When you execute the Configure Conditions... command, the text editor is started. The first time you run this command, an (almost) empty condition template is generated (consisting of a function header and some specifications with an almost empty function body). You must fill this template with Baan C code. For more information on trigger condition scripts, refer to To configure an attached condition script.
  • Configure via Dialog:

    the condition is entered in a dialog. When you execute the Configure Conditions... command, the Configure Trigger Conditions (datrg1110m000) session is started.
Action Template

Use this field to select how the action to be executed by the trigger is configured.

Select one of the following action templates from the drop-down list box:

  • Attached Script:

    The action is coded in a text that is attached to the trigger. Run the Configure Actions... command, to open this text with the text editor. The first time you run this command, an (almost) empty action template is generated. This new template consists of a function header and some specifications, and an almost empty function body. You must fill this action template with Baan C code. For more information on Trigger Action scripts, refer to To configure an attached action script.
  • Fan Out :

    The trigger will in turn invoke multiple other triggers. A fan out action is useful if a trigger must perform multiple actions in parallel, or if a trigger must use multiple conditions. In such situations, you must define a trigger that invokes multiple other triggers, which in turn implement the parallel conditions/actions. When you run the Configure Actions... command, the Configure Fan Out Action (datrg1120m000) session is started.
  • Create XML File:

    The trigger will write the event to an XML file. When you run the Configure Actions... command, the Configure XML File Action (datrg1225m000) session is started. Note The 'create XML file' action is not suitable for high volumes. For details refer to Notes on performance in the online help of the Configure XML File Action (datrg1225m000) session.

In the future, other action templates may be added.

Debug

This field indicates whether the runtime program must be generated in debug mode. The debug mode can be useful for searching an error in the program: the program can run step by step, you can trace variables and so on. For more information refer to "The Debugger" in the Infor ES Programmers Guide (Infor Support Portal KB 22924522).