[rules-users] Using Collections in LHS

Wolfgang Laun wolfgang.laun at gmail.com
Tue Feb 23 07:43:01 EST 2010


Discount is a field of Order and must not appear in an Item(...).
Probably you want:
   Order  ( $discount : Discount > 10,...

Also, most likely, all your fields need to be written with a lower case
initial letter,
   Order  ( $discount : discount > 10, $items : items)

-W

On Tue, Feb 23, 2010 at 1:11 PM, dhari <sdhari at hotmail.com> wrote:

>
> In this scenario I do have typical Order and Items data structure. I want
> to
> implement various business rules where I want to check both Order
> attributes
> and Item attributes together.
>
> Order [ Date, Discount, Amount, Customer, Type, Items]
> Item [ Quantity, Rate, ExpiresDate, Grade ]
>
> I am trying to implements following rules but all gives me syntax error. I
> wondering if someone can help me in.
>
>
> rule “one”
>    when
>        Order  ( $discount : Discount, $items : Items)
>        Item ($discount > 10 && Grade > 3) from $items
>    then
>        System.err.print(“Discount is not allowed with items having grade 3
> or
> higher)
> end
>
> rule “two”
>    when
>        Order  ( $discount : Discount, $items : Items)
>        Item ($discount  > 20 || Quantity < 5 ) from $items
>    then
>        //do some thinge
> end
> --
> View this message in context:
> http://n3.nabble.com/Using-Collections-in-LHS-tp386923p386923.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/20100223/49f8a4c9/attachment.html 


More information about the rules-users mailing list