Defining a variable

When you define a variable, use the ILOG® Rule Language syntax.

Procedure

Example

In this example, the account and contract variables refer to objects in the working memory, objects of the Account BOM class and objects of the Contract BOM class. The balance is defined as the balance of an account in the condition part of the code. Similarly, the expiration is defined as the expiration date of the contract. The variable b is an example of a variable defined in the action part of the rule.

when {
   account: Account(balance : getBalance());
   contract: Contract(expiration : getExpirationDate());
}
then {
  int b = balance;
  System.out.println(contract + expiration);
  System.out.println(account + b);
}

This rule generates a list of all the available instances of each contract and its expiration date, and each account and its balance.