<div>Hey, that was quite clever.&nbsp; Where can I find more about Day()?&nbsp; I did some research about DateFactory which I can see how dates get parsed according to the documentation, as well as compared with the conditional operators (&lt;, &gt;, &lt;=, &gt;=, etc).</div>

<div>&nbsp;</div>
<div>Thanks,</div>
<div>David<br><br></div>
<div class="gmail_quote">On Thu, Jan 29, 2009 at 5:57 AM, Anstis, Michael (M.) <span dir="ltr">&lt;<a href="mailto:manstis1@ford.com">manstis1@ford.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Hi David,</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Sorry it was of little help.</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">A rule of thumb is to stay away from &quot;eval&quot; as it kills performance (the patterns can&#39;t be indexed).</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">I&#39;m not sure if Drools can handle Date variables (the docs state it handles Data literals formatted as &quot;dd-mmm-yyyy&quot; so Cheese( date == &quot;27-Oct-2008&quot;) works).</font></span></div>

<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">I guess you could look at something like this (gees, this is going to show how &quot;green&quot; I am with Drools now):-</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Courier New" color="#0000ff" size="2">rule &quot;yuck&quot;</font></span></div>
<div dir="ltr" align="left"><span><font face="Courier New"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp; when</font></font></span></div>
<div dir="ltr" align="left"><span><font face="Courier New"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DateFactory($today : today&nbsp;)</font></font></span></div>
<div dir="ltr" align="left"><span><font face="Courier New"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $c : CreditCard( $expires : expirationDate )</font></font></span></div>
<div dir="ltr" align="left"><span><font face="Courier New" color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ArrayList( size &gt;= 0 ) from collect( Day(&nbsp;date&nbsp;&gt;= $today, date &lt;= $expires ))<br>&nbsp;&nbsp;&nbsp; then</font></span></div>
<div dir="ltr" align="left"><span><font face="Courier New"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Difference between &quot;today&quot; and &quot;expiry date&quot; is more than zero days</font></font></span></div>
<div dir="ltr" align="left"><font size="2"><font color="#0000ff"><font face="Courier New"><span>end</span><span></span></font></font></font></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">This does require the insertion of (possibly) huge amounts of Day facts. Yuck. There must be a better way (in fact your eval looks soooo much cleaner). I&#39;m just throwing out ideas. </font></span></div>

<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Good luck with your adventures with Drools.</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Mike</font></span></div><br>
<blockquote style="MARGIN-RIGHT: 0px">
<div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma" size="2">
<div class="Ih2E3d"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>David Siefert<br>
</div><b>Sent:</b> 29 January 2009 11:31<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] Working with dates in rules<br></font><br></div>
<div>
<div></div>
<div class="Wj3C7c">
<div></div>
<div>Not sure--Drools 5 temporal reasoning looks like it would be the answer.&nbsp; Only problem is that I need a solution now, so I am stuck with Drools 4.</div>
<div>&nbsp;</div>
<div>This did give me some ideas though.&nbsp; I created myself a class called TemporalReasoner.&nbsp; This has a few methods, namely to roll a date (so I can tell it x amount of time from now), and then compare it to another date.</div>

<div>&nbsp;</div>
<div>So in my rule, lets say I have a fact CreditCard with property expiration:Date (speaking uml-ishly for &quot;a property named&nbsp;&#39;expiration&#39; of type Date&quot;):</div>
<div>&nbsp;</div>
<div><font face="courier new,monospace">rule &quot;Fires when expiration less than today&quot;</font></div>
<div><font face="courier new,monospace">&nbsp; when</font></div>
<div><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; $c: CreditCard($expires : expirationDate)</font></div>
<div><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; eval(new TemporalReasoner(Calendar.getInstance()).lessThan($expires))</font></div>
<div><font face="courier new,monospace">&nbsp; then</font></div>
<div><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; // do something for when credit card is still valid</font></div>
<div><font face="courier new,monospace">end</font></div>
<div>&nbsp;</div>
<div>Now, I&#39;m still generally a noob with BRs, so I&#39;m not sure how this will affect performance.&nbsp; Any advice?</div>
<div>&nbsp;</div>
<div>Thanks,</div>
<div>David<br><br></div>
<div class="gmail_quote">On Thu, Jan 29, 2009 at 3:50 AM, Anstis, Michael (M.) <span dir="ltr">&lt;<a href="mailto:manstis1@ford.com" target="_blank">manstis1@ford.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Hi,</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">I wonder whether Drools 5 &quot;Complex Event Processing Support (Temporal Reasoning)&quot; might be what you&#39;re looking for?</font></span></div>

<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"><a href="http://blog.athico.com/2008/07/drools-50-m1-new-and-noteworthy.html" target="_blank">http://blog.athico.com/2008/07/drools-50-m1-new-and-noteworthy.html</a></font></span></div>

<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">With kind regards,</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Mike</font></span></div><br>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>David Siefert<br>
<b>Sent:</b> 29 January 2009 09:40<br><b>To:</b> Rules Users List<br><b>Subject:</b> [rules-users] Working with dates in rules<br></font><br></div>
<div>
<div></div>
<div>
<div></div>
<div>Hi-</div>
<div>&nbsp;</div>
<div>I&#39;m wondering how it would be possible to compare a part of a date in the lhs condition of a rule in a Drool.&nbsp; In other words, I need to compare a date to see if it is&nbsp;<em>x</em> days from the current date,&nbsp;<em>n</em> hours from current time, etc.&nbsp; Would anyone be kind enough to provide an example?&nbsp; I&#39;m thinking I may have to implement something of my own to offer that functionality?</div>

<div>&nbsp;</div>
<div>Big thanks,</div>
<div>David</div></div></div></blockquote></div><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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><br></blockquote></div><br></div></div></blockquote></div><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>
<br></blockquote></div><br>