[rules-users] Drools: Compound Value Restriction in Decision Table

David Smith mail at davesmith.me.uk
Fri Feb 4 18:05:57 EST 2011


Hi,

I am pocing/learning drools and I am trying to implements Compound Value
Restrictions using 'In' in a decision table.

I can do this in a rule like

rule "CoverType Example"
when
    $risk : Data( coverType in ("A","B", "C", "D"))
then
    result.add("CoverType was one of A, B C or D");
end

I can also implement this in a decision table in a long winded fashion
Condition, Action
Data,        result
coverType, add("$param")
A,              CoverType was one of A, B C or D
B,              CoverType was one of A, B C or D
C,              CoverType was one of A, B C or D
D,              CoverType was one of A, B C or D

Is there a compact way to do this using a Compound Value Restriction using
in?
Something like:

Condition, Action
Data,        result
coverType in, add("$param")
"A,B,C,D",              CoverType was one of A, B C or D

What goes in the script part "coverType in"?

The number of items in the list can be variable, so don't want to write
something that has $1, $2, $3, $4

Thanks
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110205/d2fc826d/attachment.html 


More information about the rules-users mailing list