Hello Brian,
I've done something similar previously using a combination of a field
binding constraint, an eval and the excellent joda-time API
(
http://joda-time.sourceforge.net/). If I remember right, you'd need
something along the lines of :
import org.joda.time.Duration;
import org.joda.time.DateTime;
Reference($fromDate : fromDate, eval(new Duration(new
DateTime($fromDate), new DateTime()).getMillis() >
(2*365*24*60*60*1000)))
It might be more readable if you can encapsulate this in a function :-)
Dean.
On 9/18/07, Brian Enderle <brianke(a)gmail.com> wrote:
I need to code a rule which checks that the begin date for an object
is at
least two years ago (from todays date). Is there an easy way to code this
within Drools rule, something like:
when
Reference(fromDate > (todaysDate - 2 years))
then
<Output error>
end
Thanks in advance,
Brian Enderle
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users