from (object)

This construct defines a local variable in the rule that you can use to access data from objects that are related to known objects.

Purpose

You use this construct to expand the set of data that can be used by a rule.

Syntax

from <object>

Description

The from construct is used to retrieve one distinct object from another one, and creates a variable that you can use in the rule to refer to this data. You cannot use it to retrieve a collection of objects. To access a collection of objects, use the in (list) construct.

Example

The following rule declares a variable based on the relationship between a customer and the customer's preferred item.

definitions
    set 'preferred CD' to a CD
        from the preferred item of customer;
if
     the price of 'preferred CD' is more than 25
then...

Here the decision node does not have access to "CD" objects from its input data. In this case, to write a rule that uses a CD object, you must first declare a variable of type CD that pulls in data from the preferred item object of the customer. This is possible only if the customer object (and therefore the customer's preferred item) is already known to the decision node.