<br> Hmm, now that you mentioned, I see that our parser is limiting the forall() CE, not allowing nested "from" CEs. This is something we should fix, since the limitation is purely a parser limitation.<br><br> Anyway, for your case, the workaround is simply to use the "raw" forall-equivalence: not( A() and not( B() ) ). So try this:<br>
<br>
rule "Do Not Process TAX" when<br>
$report: ExpenseReport($expenseDetails: expenseDetails) <br>
not ( $ed : ExpenseDetails() from $expenseDetails and <br> not ( ExpenseDetails( this == $ed, expenseType == ExpenseType.TAX ) from $expenseDetails )<br> )<br><div> then<br>
System.out.println("################ It works ##################");<br>
insertLogical("Bypass Process");<br>
end<br>
</div><br> This is just more verbose than the forall, but it is exactly the same. Once the parser is fixed, you will be able to simply write:<br><br>
rule "Do Not Process TAX" when<br>
$report: ExpenseReport($expenseDetails: expenseDetails) <br>
forall ( ExpenseDetails( expenseType == ExpenseType.TAX ) from $expenseDetails )<br><div> then<br>
System.out.println("################ It works ##################");<br>
insertLogical("Bypass Process");<br>
end<br>
</div>
<br> BTW, may I ask you please to open a JIRA so we don't forget to fix this for 5.0?<br><br> Thanks,<br> Edson<br><br><br><br><div class="gmail_quote">2008/5/18 Alessandro Di Bella <<a href="mailto:aldibella@gmail.com">aldibella@gmail.com</a>>:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
I have these two classes:<br>
<br>
ExpenseReport{<br>
Collection<ExpenseDetails> expenseDetails<br>
} <br>
ExpenseDetails{ ExpenseReport document<br>
ExpenseType expenseType<br>
}<br>
<br>
I am trying to create a rule that fires when all the ExpenseDetails in a<br>
ExpenseReport are of the same type:<br>
<br>
rule "Do Not Process TAX" when<br>
$report: ExpenseReport($expenseDetails: expenseDetails) <br>
forall ( <br>
ExpenseDetails(document==$report, expenseType == ExpenseType.TAX)<br>
) then<br>
System.out.println("################ It works ##################");<br>
insertLogical("Bypass Process");<br>
end<br>
<br>
For some reasons, it fires regardless that value of<br>
ExpenseDetails.expenseType.<br>
<br>
I just started with drools and any help i more than welcome.<br>
<br>
Thanks<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>