As Greg eludes to the default "min" 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"><<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>></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'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 <<a href="mailto:jkrupka@gmail.com">jkrupka@gmail.com</a>> wrote:<br>
<br>
> From: jkrupka <<a href="mailto:jkrupka@gmail.com">jkrupka@gmail.com</a>><br>
> Subject: [rules-users] accumulate min over java.util.Date<br>
> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> Date: Thursday, March 24, 2011, 12:07 PM<br>
<div><div></div><div class="h5">> Should I be able to do an accumulate<br>
> min over java.util.Date objects? Like<br>
> this:<br>
> $minDate : Date() from accumulate(MyFact ($startDate :<br>
> startDate),<br>
> <br>
> min($startDate))<br>
><br>
> I would have thought so, but when I try it, I'm getting:<br>
><br>
> Caused by: java.lang.ClassCastException: java.util.Date<br>
> cannot be cast to<br>
> java.lang.Number<br>
> at<br>
> org.drools.base.accumulators.MinAccumulateFunction.accumulate(MinAccumulateFunction.java:76)<br>
><br>
><br>
><br>
> If it should work, then it's possible I'm doing something<br>
> else wrong, but<br>
> everything looks correct to me. I can always work<br>
> around it by getting the<br>
> milliseconds from the Date object and doing the min over<br>
> that... it's just<br>
> not as clean looking.<br>
><br>
> --<br>
> 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>
> Sent from the Drools - User mailing list archive at<br>
> Nabble.com.<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>
<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>