Rule Builder > Debugging and Profiling > Debugging > Adding Test Objects to Working Memory |
Adding Test Objects to Working Memory |
PREVIOUS NEXT |
Before you can get your rules or rules in a ruleflow to fire and test them, you need to initialize the working memory and the ruleset parameters of the engine with specific objects. These objects provide the information state required by the rules that enable them to fire.
You can add objects to working memory, declare ruleset parameters, prepare object iterators (for tasks using sequential mode only) to test rules and ruleflows.
Objects can be declared to the engine before execution using the ilrmain
function available in the Rule Builder. The ilrmain
function is similar to the main method of a Java application. An example of such a function is given below; this example initializes the working memory so that it contains two objects:
These objects should lead to the execution of the following BAL rule:
If
the shoppingCart contains more than $100
and the customer category is silver
change the customer category to Gold
and apply a 15% discount
In a case where the rules or ruleflow require ruleset parameters instead, a modified ilrmain
function could look like the following:
Adding Functions to a Top-Level Package | Executing Rules in Sequential Mode
Customer Support | Copyright © 1987-2004 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |