<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
This is a user question, please post it to the rules user list.<br>
<br>
Mark<br>
Jim Majure wrote:
<blockquote
 cite="mid:D4F1C634186BFF45B1F01601EA194DE11CB014@everhopper.SourceAlliesInc.local"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <div><font color="#000000" face="Arial" size="2"><span
 class="postbody">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 class="genmed"></span><br>
        </td>
      </tr>
      <tr>
        <td class="code">
        <pre>Reject a claim if it contains a treatment that has already been claimed more than 70 times 
in the same calendar month.        </pre>
        </td>
      </tr>
    </tbody>
  </table>
  <span class="postbody"><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 class="genmed"></span><br>
        </td>
      </tr>
      <tr>
        <td class="code">
        <pre>rule
    when
        Treatment(id=="t1", status=="pending")
        Treatment(id=="t1", status=="paid")
        Treatment(id=="t1", status=="paid")
    then
        assert ( new Rejection("reason"));
end
        </pre>
        </td>
      </tr>
    </tbody>
  </table>
  <span class="postbody">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>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
  </pre>
</blockquote>
<br>
</body>
</html>