As Greg eludes to the default "min" accumulate function expects (java.lang.)Numbers.

If you require one to handle dates you can write your own custom Accumulate Function.

On 24 March 2011 17:50, Greg Barton <greg_barton@yahoo.com> wrote:
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.

--- On Thu, 3/24/11, jkrupka <jkrupka@gmail.com> wrote:

> From: jkrupka <jkrupka@gmail.com>
> Subject: [rules-users] accumulate min over java.util.Date
> To: rules-users@lists.jboss.org
> Date: Thursday, March 24, 2011, 12:07 PM
> Should I be able to do an accumulate
> min over java.util.Date objects?  Like
> this:
> $minDate : Date() from accumulate(MyFact ($startDate :
> startDate),
>            
>         min($startDate))
>
> I would have thought so, but when I try it, I'm getting:
>
> Caused by: java.lang.ClassCastException: java.util.Date
> cannot be cast to
> java.lang.Number
>     at
> org.drools.base.accumulators.MinAccumulateFunction.accumulate(MinAccumulateFunction.java:76)
>
>
>
> If it should work, then it's possible I'm doing something
> else wrong, but
> everything looks correct to me.  I can always work
> around it by getting the
> milliseconds from the Date object and doing the min over
> that... it's just
> not as clean looking.
>
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-java-util-Date-tp2726081p2726081.html
> Sent from the Drools - User mailing list archive at
> Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users