You really ought to read all the pertaining sections in the Drools Expert manual and experiment. Nobody can write complex rules without some exercise.
2010/2/24 dhari <sdh...@hotmail.com> > Thanks Jeffery. I'll try this but what if I have more complex condition > e.g. > > > Order ($discount : discount, $items : items) > Item(grade > 3 && (quantity < 5 || $discount > 10)) from $items > Again, you are using a condition on discount not next to the field in the fact where it occurs (i.e., Order); it's just not possible to write it this way. Order( discount > 10, $items : items ) # all Orders where discount > 10 Item( grade > 3, quantity < 5 ) from $items # and each of its Items where grade > 3 and quantity < 5 There is no need to use && to combine two conditions for the same fact. Now if you need to detect Order Items with grade > 3 where either the quantitiy of the Item is < 5, or the Order's discount > 10, (or both) you'd have to write Order( $discount : discount, $items : items ) # all Orders Item( grade > 3, $quantity : quantity) from $items # and each of its Items where grade > 3 eval( $discount > 10 || $quantitiy < 5 ) # and discount > 10 or quantity < 5 (or both) -W
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users