[rules-users] Using Collections in LHS

Wolfgang Laun wolfgang.laun at gmail.com
Wed Feb 24 13:08:16 EST 2010


2010/2/24 Ansgar Konermann <ansgar.konermann at googlemail.com>:
>
> rule "Issue error message if items preventing discount exist"
> when
>   exists( ItemPreventingDiscount( $reason: reason, $item: item ) )

The exists isn't correct here; it prevents binding for $reason and
$item used on the RHS.

> then
>   System.out.println("Discount not allowed: Item '"+ $item.getDescription()
> + "' prevents discount because " + $reason + ".");

Probably should use a retract on the ItemPreventingDiscount here.
Creating these XPreventingY facts would really make sense if they are
later combined into a single error report against the Order.
-W

> end
>




More information about the rules-users mailing list