Variables available in rules

Several types of variables are available when you write rules. Variables include the bound entity and the events that are defined in the agent descriptor, variables in the definitions part of the rule, and variables that are defined at the agent project level.

The following table lists the different types of variable that you can use in your business rules.

Variable Scope Definition and use

Processed event

An event that is processed by the rule agent.

The events that are processed by the agent are defined in the agent descriptor.

In a rule, you refer to the processed event in the when clause, for example, when a flight event occurs. You can then refer to this event as this flight event.

To simplify the rule, you can also create a local variable for this event, for example, when a flight event occurs, called 'the event'. Then, you use this variable in the rule to refer to the event.

For more information on how to define the events that are processed by the agent, see Completing the agent descriptor and Bound entity and events.

Bound entity

The bound entity of the agent is a ruleset parameter of the agent.

You can use the variable of the bound entity in all the rules of the agent.

The bound entity is the main data element on which the rule operates.

The variable for the bound entity is based on the information from the agent descriptor. For example, if an agent is related to a flight entity, the variable available in the rule is 'the flight'.

For more information on how to define the bound entity of the agent, see Completing the agent descriptor and Bound entity and events.

Rule variable

A variable that can be referenced only in the action rule in which it is defined.

You define a rule variable in the definitions part of the rule.

Rule variables are local to the rule in which they are defined. They are not available in other rules. The variable name must be unique within the rule.

For more information on how to create local variables in rules, see Adding a definitions part.

Implicit variable

A variable that is automatically declared by a language construct like a binding. For example:

set ‘var-name’ to <a type> where ..., there is a ..., there are ..., for each...

The name, type and value are controlled by the system.

You use implicit variables to refer to a current instance of an object that is being tested or declared, or to a collection being iterated.

For more information on implicit variables, see Simplifying phrases with implicit variables.