You are here: LANSA for i User Guide > 2. Fields > 2.13 Triggers

2.13 Triggers

This display results when:

 

DC@P700103                 Define / Change a Trigger                   

                                                                       

                                                                       

 File      : XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

 Field     : XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

                                                                       

 Order to process / source  . . . . . 999 / DATA DICTIONARY            

 User description of trigger  . . . . _________________________        

 Trigger Function Name  . . . . . . . _______                          

                                                   Before     After    

 Trigger Point(s) . . . . . . . . . . Open           _          _      

                                      Close          _          _      

                                      Read           _          _      

                                      Insert         _          _      

                                      Update         _          _      

                                      Delete         _          _      

                                                                       

                       And/Or Field      Op   Field/Literal            

 Trigger When . . . . .        _______  ___  ____________________      

                          ___  _______  ___  ____________________   +  

                                                                       

                                                                       

 Fnn=Help  Fnn=Exit  Fnn=Cancel  Fnn=Messages                          

 

 

Note that file name is only displayed when working at file level. Change and Delete command keys are only enabled when displaying an existing check.

 

If an existing trigger is being reviewed then the CHANGE key can be used to place the screen in change mode and the required changes made.

If an existing trigger is being reviewed then the DELETE key can be used to delete the trigger. Note that the delete is immediate. No confirmation is required.

If a new trigger is being added then the screen will be presented initially with default values. Change as required and press Enter to complete specification of the trigger.

Input Options

These input options apply to a trigger:

Order to Process

Mandatory, but always prefilled to <highest order number + 10>. Triggers are performed (and displayed) in the sequence of these order numbers (within the trigger level). Order numbers must be unique within the trigger level.

For instance, TRIG04, TRIG01, TRIG02, TRIG05, TRIG03 would be performed.

Trigger

Level

Order To Process

TRIG01

Dictionary

100

TRIG02

Dictionary

200

TRIG03

File

20

TRIG04

Dictionary

50

TRIG05

File

10

 

Source

Output field. Indicates the source or level at which the trigger applies.

User Description of Trigger

Mandatory. Enter a brief description of the trigger to aid other users in understanding its purpose.

Trigger Function Name

Mandatory. Enter the name of the trigger function which will be called when the trigger conditions are satisfied. The named function must be defined with the TRIGGER parameter on the FUNCTION command. (Refer to the FUNCTION command in the Technical Reference Guide for details).

Trigger Points

At least one point where the function is to be triggered must be entered (by entering a "Y" at the required point).

Trigger When

Optional. If no test conditions are specified the trigger will be unconditionally invoked.

Rules for entering conditions are as follows:

GT 

Greater than

GE 

Greater than or equal to

LT 

Less than

LE 

Less than or equal to

EQ 

Equal to

NE 

Not equal to

REF

Refers to

Examples

Trigger field:

Name

Type

Len

Dec

SALARY

P

12

2

 

 

Trigger function:

Name

Function

Trigger Before

Points After

Comments

TRGFN1

Open

 

 

Call trigger function TRGFN1 following an insert or update of field SALARY, or before a delete of field SALARY. Note that no conditions have been applied to this trigger.

 

Close

 

 

 

Read

 

 

 

Insert

 

Y

 

Update

 

Y

 

Delete

Y

 

 

Refer to Trigger Functions for full details and examples.