| ILOG JRules User Guide > Writing Rules > Concepts > Automatic Variables |
Automatic Variables |
PREVIOUS NEXT |
Automatic variables are variables that you declare as an instance of a specific BOM class. They are available in all the business rule artifacts that use the BOM class where the variable was declared.
When you specify an automatic variable, it is defined for the corresponding business term, and identified with the article "the". For example, if customer is a business term, a corresponding variable called the customer is available in the rule editors.
You cannot define one variable to be the same as another variable of the same type. If your rule requires you to refer to more than one occurrence of customer, you have to define the other variables explicitly, in the definitions part of the rule. In this case, the automatic variable will no longer be available in this rule.
The automatic variable is known internally as customer. The variable the customer is the automatic variable in a given verbalization context (with definite article the) and is the form that you can use in rules to reference this variable. Consequently, you cannot declare another variable named customer in the definition part of a rule:
definitions
set 'customer' to a customer;
This statement will generate the error:
"An automatic variable 'customer' is already declared"
In the following rule, ceiling is an explicit variable declared in the definitions part of the rule, and the customer is an automatic variable.
definitions set ceiling to 10,000; if the value of the shopping cart of the customer is more than ceiling then...
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |