Using objects that are not in memory in a condition
When you write conditions, you can use objects that are not in memory by referring to relations from objects that are available.
Procedure
To use objects that are not in memory when you write a
condition, use the following pattern:
<condition> in <group>
<condition> from <instance>
In this pattern, <group> is an expression that returns an object array, a collection, or an enumeration, and <instance> is an object.
Example
In this example, contract is a group of objects that is in the working memory. The condition can apply to the object account.getCurrency because of its relation with contract.getAccounts. With this condition, the rule executes all the objects.
when {
contract : Contract();
account : Account() in contract.getAccounts();
currency : Currency() from account.getCurrency()
}