Have you considered the simple fact that a month may have between four (full) and six (one or two fractional) weeks? Reminder objects ought to have a field identifying the week; if they have its easy to count them per week if they are simple facts in WM.<br>
<br>Note that the identificaton of weeks by running number per year also has up to two fractional weeks.<br><br>-W<br><br><br><div class="gmail_quote">On Mon, Apr 27, 2009 at 6:08 PM, Brody bach <span dir="ltr">&lt;<a href="mailto:brodybach@yahoo.com">brodybach@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hi all,<br>
<br>
I&#39;m having difficulty in defining a rule for the following problem:<br>
We need to check if within a week there are more than 5 objects of type<br>
Reminder inserted into Memory.<br>
(one day corresponds to one object)<br>
The number of the inserted objects depends on the usage of the application.<br>
That means there could be nothing, 1, 2, or any number of the objects.<br>
Before, within a session, I inserted a list containg data from within one<br>
week (7 days).<br>
Than I can check using the rule:<br>
when:<br>
$list : list(size &gt; 5)<br>
Reminder() from $list<br>
no String(trim == &quot;limit reached&quot;);<br>
then<br>
System.out.println(&quot;This rule fires&quot;);<br>
insert new String(&quot;limit reached&quot;);<br>
<br>
Now I need to insert a list containing data from a whole month, but I still<br>
need to check whether within one week there are more than 5 reminders exist.<br>
<br>
so, the constraint list&gt; 5 can&#39;t be used anymore for a single list. I tried<br>
to break the whole list in several smaller list, where each list represents<br>
one week.<br>
Now the problem is, if the rule fires for a certain week, than it won&#39;t work<br>
for the following weeks anymore.<br>
<br>
My idea is then to insert an integer containing specific number to the<br>
current list, i.e. the calendar week (i.e insert new Integer(52)) and then<br>
to prove this in LHS; but the problem is now how to prove the week number in<br>
LHS? as I remeber, a function can only be called within an eval statement<br>
and  in this case actually I should only prove the existence of an Integer<br>
<br>
Hope my explanation is quite understandable and looking forward for any<br>
hints<br>
<br>
Regards<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/need-some-advice-in-defining-rules-tp23259683p23259683.html" target="_blank">http://www.nabble.com/need-some-advice-in-defining-rules-tp23259683p23259683.html</a><br>

Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">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>
</font></blockquote></div><br>