On 11/06/2014, brachi <brachi.w(a)sapiens.com> wrote:
example of rule that doesn't work without eval:
/* rule "1"
salience -1
agenda-group "agenda1"
when
$conclusion: supportFT()
Where's the eval?
then
if($conclusion.getValue()==null){
modify($conclusion) { setValue(new ArrayList())};
}
$conclusion.getValue().add("supportedValue");
modify($conclusion) { setValue($conclusion.getValue()) };
You might use a simple update() here.
end
rule "2"
salience -2
agenda-group "agenda2"
when
supportFT(Operators.containsAny(value,new
String[]{"supportedValue","otherValue"}))
This can be written using the clearer and cleaner syntax
supportFT( value in ("supportedValue","otherValue") )
$conclusion: ConclusionFt()
Moreover, this should contain the constraint
$conclusion: ConclusionFt( value != "success" )
then
modify($conclusion){setValue("success")};
Here, ConclusionFt's attribute value is a simple String, but in that
other rule it is set to an ArrayList.
-W
end*/
rule "2" doesn't hit, works only with eval in rule "2".
in this example I can add eval, because the Fact Types model is different,
so the rule doesn't reevaluated.
because I had this case, I decided to add eval for all constraints, but
unfortunately I had an infinite loop.
--
View this message in context:
http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users