<br> If you are using 3.1M1 or later (trunk), you can do:<br><br>rule xyz<br>when<br> Treatment( $id : id, status == "pending" )<br> ArrayList( size >= 70 ) from ( Treatment( id == $id, status == "paid" ) )
<br>then<br> assert( new Rejection( "reason" ) )<br>end<br><br> If you are using 3.0.x, you will need 2 rules. One rule will count the occurrences and the other will check if total is greater than 70.<br><br>
[]s<br> Edson<br><br><br><br><br><div><span class="gmail_quote">2007/3/29, Jim Majure <<a href="mailto:Jim@sourceallies.com">Jim@sourceallies.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div><font color="#000000" face="Arial" size="2">
<div><font color="#000000" face="Arial" size="2"><span>I have what I
think is a very simple rule to implement, but I can't find a way to do it
without "cheating" by using an eval/function. Here's the basic rule in English:
<br></span>
<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%">
<tbody><tr>
<td><span><b></b></span><br></td></tr>
<tr>
<td><pre>Reject a claim if it contains a treatment that has already been claimed more than 70 times <br>in the same calendar month.        </pre></td></tr></tbody></table><span><br>In other words, I need to count the number of instances of
the treatment that have already been paid. <br><br>Assume for the sake of this
discussion, my facts are instances of the <span style="color: darkred;">Treatment</span> class. <br><br>If I replace "70" with,
say, "2" in this rule I could do this: <br></span>
<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%">
<tbody><tr>
<td><span><b></b></span><br></td></tr>
<tr>
<td><pre>rule<br> when<br> Treatment(id=="t1", status=="pending")<br> Treatment(id=="t1", status=="paid")<br> Treatment(id=="t1", status=="paid")
<br> then<br> assert ( new Rejection("reason"));<br>end<br>        </pre></td></tr></tbody></table><span>Unfortunately, I can't
simply replace "70" with "2", and using the same strategy to check for 70
instances doesn't seem quite right. <br><br>Am I missing something very simple
here? Are there standard strategies to deal with this type of
rule?</span></font></div></font></div></div><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151<br> JBoss, a division of Red Hat @
<a href="http://www.jboss.com">www.jboss.com</a>