Other Points Related to Action Execution

There are also a couple of other interesting points worth mentioning when describing execution of actions.

  • When a reference attribute of some object is modified and this reference attribute has matching attribute on the referred object, the referred object is modified as well and its rules (if any) are evaluated (see Reference Attributes for the explanation of what matching attribute is).

For example, let us assume that the Policy object has a reference to the Driver object like in the previous example. Let us also assume that this attribute has a matching reference on the Driver object called MyPolicies, which refers to all the policies of a driver. The relationships between objects are illustrated in the following diagram:

Let us also assume that there is a rule somewhere that sets the reference of some instance of the Policy object to some instance of the Driver object:

Policy.MyDriver=Driver 

This action modifies the instance of the Policy object and so any rules attached to the Policy are evaluated. This is not the only thing that happens, however. Because the MyDriver attribute of the Policy object has a matching attribute in the Driver object (MyPolicies), the instance of the Driver object that is set into the Policy is modified as well – the instance of the Policy object appears in its list of policies. Consequently if there are any rules attached to the Driver object they are evaluated as well.

  • The rules that check whether the existing member has been changed in a list are considered to be cross-reference rules.

Let us assume hypothetically that the Driver object has the attribute TotalExcess that is supposed to store the cumulative excess across all policies of a particular driver. Consider the following rule attached to the Driver object, which re-calculates the value of total premium whenever one of its policies changes in any way:

IF Policy FROM Driver.MyPolicies WAS CHANGED THEN 
   Driver.TotalPremium = SUM Policy.Excess WHERE Policy IN Driver.MyPolicies 

Even though there is no attribute of some business object that is referred to through a reference of another business object in this rule, the rule is still considered to be a cross-reference rule. So if a user modifies attributes of some Policy object the rules of the related instance of the Driver object are automatically evaluated as well and the total premium is re-calculated.

  • Last modified: 2022/09/13 18:15