[rules-users] Date Condition in Decision tables

Michael Anstis michael.anstis at gmail.com
Thu Feb 24 06:51:18 EST 2011


OK, in DRL terms this would be something like this (I've not checked the
syntax, but it gives you an idea):-

function boolean isTooOld(Calendar usd, Calendar crd, int age) {
    crd.add(Calendar.DAY_OF_YEAR, age);
    return crd.after(usd);
}

rule "old claims"
when
    Parameters( $usd : userSpecifiedDate, $param : maxAge )
    Claim( $crd : claimRequestDate )
    eval(isTooOld( $usd, $crd, $param ) )
then
    System.out.println("that's an old claim");
end

I used a function to increase readibility. You could have placed the logic
in-line or a helper function on a domain object.

You should then be able to convert this into a decision table.

With kind regards,

Mike

On 24 February 2011 11:08, sdinoo <sdinoo at gmail.com> wrote:

>
> lets say instead of =now() I am using a user-specified date(usd). I want to
> calculate (usd - claimRequestDate) in the Condition something like <usd -
> ClaimREquestDate) > "$param"
>
> I the data for that condition I want to put an integer say 65 - the rule
> should fire when the condition is met
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Date-Condition-in-Decision-tables-tp2565936p2566732.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110224/cfc3984b/attachment.html 


More information about the rules-users mailing list