<html><body><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div>It looks like you have may have to start with a simple representation of the calendar, for&nbsp;all weeks in a given year. I am not sure exactly what you are trying to accomplish - you could generate these kinds of facts,&nbsp;as many as you need,&nbsp;from Java (or any other language) dynamically. You may need 52 weeks in a year or may need less (part of the year) or more (more than a year), depending on the application.</div>
<div>&nbsp;</div>
<div>Nevertheless, it is good you are seeking opinions from this good group!</div>
<div>&nbsp;</div>
<div>Ravi.</div>
<div>&nbsp;</div>
<BLOCKQUOTE style="PADDING-LEFT: 8px; FONT-SIZE: 10pt; MARGIN-LEFT: 8px; BORDER-LEFT: blue 2px solid; COLOR: black; FONT-FAMILY: verdana" webmail="1">
<div   >-------- Original Message --------<BR>Subject: Re: [rules-users] need some advice in defining rules<BR>From: Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;<BR>Date: Tue, April 28, 2009 4:37 pm<BR>To: Rules Users List &lt;rules-users@lists.jboss.org&gt;<BR><BR>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 <FONT dir=ltr>&lt;<A onclick="return true;if(window.location==top.location){Popup.composeWindow('pcompose.php?sendto=brodybach%40yahoo.com');}else{top.Popup.composeWindow('pcompose.php?sendto=brodybach%40yahoo.com');}; return false;" href="mailto:brodybach@yahoo.com" target=_blank mce_href="mailto:brodybach@yahoo.com">brodybach@yahoo.com</A>&gt;</FONT> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>Hi all,<BR><BR>I'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 == "limit reached");<BR>then<BR>System.out.println("This rule fires");<BR>insert new String("limit reached");<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'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'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 &nbsp;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 mce_href="http://www.nabble.com/need-some-advice-in-defining-rules-tp23259683p23259683.html">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 onclick="return true;if(window.location==top.location){Popup.composeWindow('pcompose.php?sendto=rules-users%40lists.jboss.org');}else{top.Popup.composeWindow('pcompose.php?sendto=rules-users%40lists.jboss.org');}; return false;" href="mailto:rules-users@lists.jboss.org" target=_blank mce_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 mce_href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><BR></FONT></BLOCKQUOTE></DIV><BR>
<HR>
_______________________________________________<BR>rules-users mailing list<BR>rules-users@lists.jboss.org<BR><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank mce_href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><BR></DIV></BLOCKQUOTE></span></body></html>