Reference > Rule Languages > Business Action Language > BAL Constructs > from <object>

Summary

Expands the set of data that can be used by rules by enabling you to access objects that are related to known objects.

Syntax

from <object>

Description

By default, rules are used to process a set of data established by the developer of an application. If you need to access data that is not in this set, but related to a data object in this set, you can use the from construct to define a variable that pulls a data object in from a related object.

The from construct is used to retrieve one distinct object from another one. 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 their preferred item.

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

By default, the rule engine does not know what a "CD" object is. 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 because the customer object (and therefore the customer's preferred item) is already known to the rule engine.

Related Concepts

Rule Conditions

Related Tasks

Creating Business Rules

Related Reference

definitions
if
where <test>

Related Samples and Tutorials

Tutorial: Creating Business Rules