<br>&nbsp;&nbsp; If you are using 3.1M1 or later (trunk), you can do:<br><br>rule xyz<br>when<br>&nbsp;&nbsp;&nbsp; Treatment( $id : id, status == &quot;pending&quot; )<br>&nbsp;&nbsp;&nbsp; ArrayList( size &gt;= 70 ) from ( Treatment( id == $id, status == &quot;paid&quot; ) )
<br>then<br>&nbsp;&nbsp;&nbsp; assert( new Rejection( &quot;reason&quot; ) )<br>end<br><br>&nbsp;&nbsp; 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>
&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><br><br><br><div><span class="gmail_quote">2007/3/29, Jim Majure &lt;<a href="mailto:Jim@sourceallies.com">Jim@sourceallies.com</a>&gt;:</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&#39;t find a way to do it 
without &quot;cheating&quot; by using an eval/function. Here&#39;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 &quot;70&quot; with, 
say, &quot;2&quot; 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==&quot;t1&quot;, status==&quot;pending&quot;)<br>        Treatment(id==&quot;t1&quot;, status==&quot;paid&quot;)<br>        Treatment(id==&quot;t1&quot;, status==&quot;paid&quot;)
<br>    then<br>        assert ( new Rejection(&quot;reason&quot;));<br>end<br>        </pre></td></tr></tbody></table><span>Unfortunately, I can&#39;t 
simply replace &quot;70&quot; with &quot;2&quot;, and using the same strategy to check for 70 
instances doesn&#39;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>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3124-6000<br>&nbsp;&nbsp;Mobile: +55 11 9218-4151<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ 
<a href="http://www.jboss.com">www.jboss.com</a>