Updating the bound entity

A rule can update the state of the bound entity upon the arrival of an event.

You can add conditions to determine if the entity must be updated. For example, you can add condition and filtering expressions on the bound entity and on remote entities, on the event that is processed and the events that are in the working memory. In the then part of the rule, you update the values of the bound entity.

Warning: An agent can update the state of its bound entity, but it cannot update the state of remote entities, that is entities that a related to the bound entity. If an agent detects that a remote entity must be updated, the agent can emit a notification event. For more information, see Emitting an event.

The following rule updates the balance and the status of the account entity when an initial pay-in is received.

when an initial payin event occurs
if
    the amount of this initial payin event is more than 15
then
    set the balance of 'the account' to the amount of this initial payin event;
    set the status of 'the account' to ACTIVE;

The following rule updates the state of the order entity when a pizza order happened 30 minutes before now.

when a pizza order has occurred 30 minutes ago
if
    the order status of ‘the order’ is PRICED
then
    make it true that ‘the order’ is late;