[rules-users] Drools: how do I compare two fields in a Decision Table

Wolfgang Laun wolfgang.laun at gmail.com
Sun Feb 6 15:02:07 EST 2011


One way:

Risk
transactionDate
compare tD to...
attachmentDate
someOtherDate

The "==" is added automatically. Leave the cell in the column empty to omit
constraint for a rule.

If you need a choice between this constraint and no constraint, you may use

Risk
transactionDate == attachmentDate /*$param*/
tD eq aD
x

and leave the cell in the column empty to omit constraint for a rule.

-W






On 6 February 2011 15:12, David Smith <mail at davesmith.me.uk> wrote:

> Hi,
>
> How do I compare two fields in a decision table e.g.
> transactionDate==attachmentDate
>
> I can create a rule that has a restriction using two fields such as
>
> rule "check if risk is active"
> when
>    $risk : Risk(transactionDate==attachmentDate)
> then
>    ...
> end
>
> I can do this using an eval statement in a decision table
>
> Condition
> $risk:Risk
> eval($risk.getAttachmentDate().equals($risk.getTransactionDate()))
>
> How do I write this without an eval?
> I want to write something similar to the rule above:
>
> Condition
> $risk:Risk
> attachmentDate == transactionDate
>
> Thanks
> David
> _______________________________________________
> 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/20110206/035c2060/attachment.html 


More information about the rules-users mailing list