Configure Trigger Conditions (datrg1110m000)

Use this session to enter one or more conditions for a trigger.

You can define multiple separate conditions that are connected via a logical 'And' or via a logical 'Or'. Refer to the online field help for more information. Conditions defined for a trigger will only check the top level component. This session is a modal dialog. When you leave this session and return to the Triggers (datrg1100m000) session, the trigger program is regenerated automatically, if the action settings were changed.

Example

The following example shows a setup for three triggers.

Triggers:

Trigger Description Path for Program Condition Template
quotation New quotation created in ERP e:\Trigger\Objects Dialog
customer Customer is made inactive e:\Trigger\Objects Dialog
order Order status changed e:\Trigger\Objects Dialog

Conditions for 'quotation' trigger:

Seq. Nr. And / Or Type Comp. Attribute Operator Value Becomes
10   Class     = Quotation  
20 And Event     = Create  
30 And Attribute Quotation Status = Entered No

Note that the condition on Class is only needed if the same trigger can receive events from multiple different classes.

Conditions for 'customer' trigger:

Seq. Nr. And / Or Type Comp. Attribute Operator Value Becomes
10   Attribute Customer Status <> Active Yes
20 Or Event     = Delete No
30 And Attribute Customer Status = Active No

Conditions for 'order' trigger:

Seq. Nr. And / Or Type Comp. Attribute Operator Value Becomes
10   Attribute Order Status Changed    

Field Information

Sequence Number

A number to indicate the sequence in which:

  • the conditions must be evaluated.
  • the conditions are displayed

If two conditions have the same sequence number, the evaluation sequence is equal to the sequence in which the user entered or saved the conditions.

And/Or

The Boolean operator that indicates how a condition is linked to the previous one:

  • 'Or' (the entire trigger condition is met if one of the conditions is met), or
  • 'And' (the entire trigger condition is met if all conditions are met).

This field is unused for the first condition. Note that no parentheses () are available for defining conditions. So, a condition such as:

eventtype is 'create' and (status = 2 or status = 3)

must be defined as:

eventtype is 'create' and status = 2 or event type = 'create' and status = 3.

Condition Type

A condition can check either the event type, the class or an attribute value. Therefore the condition types are :

  • Attribute Value
  • Event Type
  • Class

If you choose a value other than 'Attribute Value', the attribute is irrelevant and cannot be filled.

You only need Conditions on class or event type if the same trigger is invoked for events on multiple classes or event types.

Attribute

The name of the attribute to be checked.

Operator

The comparison operator that is used for the class, event type or attribute. Available operators are

  • Equal (=)
  • Not Equal (<>)
  • Less Than (<)
  • Less Than or Equal To (<=)
  • Greater Than (>)
  • Greater Than or Equal To (>=)
  • Changed. You can use this operator to test whether the value of an attribute differs from the previous value.

Notes regarding the 'Changed' operator:

  • In case of a create or delete event all attributes are 'changed'. In case of change events however, some attributes may have changed while others are not 'changed'.
  • You can only select the 'Changed' operator if the condition type is 'Attribute Value'.
  • If you select the 'Changed' operator, you cannot enter a value for the attribute.
Value

The value that must be checked. If the condition type is 'Event Type', the value must be 'create', 'change', 'delete' or another event type that can be input for the trigger.

If the condition type is 'Class' the value must be a class that can be used in a trigger.

In other cases the value is an attribute value that must be checked.

Data Type

The type of the attribute used in the condition.

  • Enter "Number" if the attribute to be checked contains a numeric value (either with or without decimals).
  • Enter "String" if the attribute to be checked contains a string.

Note

You can only edit this field when the condition type is "Attribute Value" and the operator is unequal to "Changed". In all other cases the data type is irrelevant

Notes on numbers and strings

The following examples show how numbers are handled differently from strings.

Conditions on string values:

  • If myAttribute contains "hello", condition myAttribute = "0" is not met
  • If myAttribute contains "", condition myAttribute = "0" is not met
  • If myAttribute contains "1234", condition myAttribute = " 1234" is not met
  • If myAttribute contains "456", condition myAttribute > "12345" is met

The same conditions on numeric values:

  • If myAttribute contains "hello", condition myAttribute = "0" is met (because the 'value' of "hello" is 0)
  • If myAttribute contains "", condition myAttribute = "0" is met
  • If myAttribute contains "1234", condition myAttribute = " 1234" is met (because both values are equal)
  • If myAttribute contains "456", condition myAttribute > "12345" is not met (because 456 is less than 12345)

For strings, leading spaces are relevant, but trailing spaces in the Value field are not taken into account. So a condition myAttribute = " 1234 " is regarded as: myAttribute = " 1234".

Notes on specific data types

  • Enumerate descriptions are strings, enumerate values are numbers.
  • Date and time numbers are numbers, formatted dates are strings. Note that if the date format is DDMMYYYY, for example, a comparison condition using '<', '<=, '>' or '>=' will not be useful. Either use another date format (such as YYYYMMDD) in that case, or program the condition in an Attached Script.
  • For numbers having decimals, use a '.' as the decimal sign.
  • Numbers in exponential format are handled as numbers.
  • Text numbers are numbers.

Complex data types (such XML sub-trees containing text contents) cannot be handled in a condition.

Becomes

This field indicates when a condition is met:

  • Becomes = No: the condition is met if either the old or the new attribute value meets the condition
  • Becomes = Yes: the condition is met only if the old value does not meet the condition but the new value does.

For detailed information, refer to The 'becomes' setting