Basically, you can either update an object with the results of the first
rule, or create a new object.
Like:
rule "Hungry"
when
$person : Person(hoursSinceLunch>2 || donutsOnDesk==0 ||
candybarsInDrawer==0)
then
$person.setHungry(true);
update($person);
end
rule "Food"
when
$person : Person(hungry==true)
then
$person.lookForFood()
end
or
rule "Hungry"
when
$person : Person(hoursSinceLunch>2 || donutsOnDesk==0 ||
candybarsInDrawer==0)
then
$hungry=new Hungry();
$hungry.setPerson($person);
insert($hungry);
end
rule "Food"
when
$person : Person()
$hungry : Hungry(person==$person)
then
$person.lookForFood()
end
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-reuse-a-result-of-a-rule-in-an-o...
Sent from the Drools: User forum mailing list archive at
Nabble.com.