[rules-users] Using Collections in LHS

Shabbir Dhari sdhari at hotmail.com
Tue Feb 23 17:27:03 EST 2010




Hi W



I know about case sensitivity issue. How can I combine both Order and Item in
one condition. I tried all possibilities but getting syntax error.



For example: 
Order ($items : items, $discount : discount > 10, Item(grade > 3)
from $items) // gives error


Can please code this condition correctly for me?

Dhari



Date: Tue, 23 Feb 2010 13:43:01 +0100
From: wolfgang.laun at gmail.com
To: rules-users at lists.jboss.org
Subject: Re: [rules-users] Using Collections in LHS

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


 		 	   		  
_________________________________________________________________
Link all your email accounts and social updates with Hotmail. Find out now
http://windowslive.ninemsn.com.au/oneinbox?ocid=T162MSN05A0710G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100223/9628080f/attachment.html 


More information about the rules-users mailing list