As Greg eludes to the default &quot;min&quot; accumulate function expects (java.lang.)Numbers.<br><br>If you require one to handle dates you can write your own custom Accumulate Function.<br><br><div class="gmail_quote">On 24 March 2011 17:50, Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">That&#39;s because a java.util.Date is not a java.lang.Number. :)  You can get the long value behind the Date by calling Date.getTime(), though.  Try that.<br>

<br>
--- On Thu, 3/24/11, jkrupka &lt;<a href="mailto:jkrupka@gmail.com">jkrupka@gmail.com</a>&gt; wrote:<br>
<br>
&gt; From: jkrupka &lt;<a href="mailto:jkrupka@gmail.com">jkrupka@gmail.com</a>&gt;<br>
&gt; Subject: [rules-users] accumulate min over java.util.Date<br>
&gt; To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; Date: Thursday, March 24, 2011, 12:07 PM<br>
<div><div></div><div class="h5">&gt; Should I be able to do an accumulate<br>
&gt; min over java.util.Date objects?  Like<br>
&gt; this:<br>
&gt; $minDate : Date() from accumulate(MyFact ($startDate :<br>
&gt; startDate),<br>
&gt;            <br>
&gt;         min($startDate))<br>
&gt;<br>
&gt; I would have thought so, but when I try it, I&#39;m getting:<br>
&gt;<br>
&gt; Caused by: java.lang.ClassCastException: java.util.Date<br>
&gt; cannot be cast to<br>
&gt; java.lang.Number<br>
&gt;     at<br>
&gt; org.drools.base.accumulators.MinAccumulateFunction.accumulate(MinAccumulateFunction.java:76)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; If it should work, then it&#39;s possible I&#39;m doing something<br>
&gt; else wrong, but<br>
&gt; everything looks correct to me.  I can always work<br>
&gt; around it by getting the<br>
&gt; milliseconds from the Date object and doing the min over<br>
&gt; that... it&#39;s just<br>
&gt; not as clean looking.<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-java-util-Date-tp2726081p2726081.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-java-util-Date-tp2726081p2726081.html</a><br>

&gt; Sent from the Drools - User mailing list archive at<br>
&gt; Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
<br>
<br>
<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>
</div></div></blockquote></div><br>