Why are you writing it using Drools? Will you also have a lot of other rules in your system? If the answer is no, you may want to go another route.

If the answer is yes, I would suggest contraining the No of purchase so there are no overlapping ranges, i.e. No Pens Purchased >=10, >=5 < 10, and >=2 and < 5. Also, have a summary or some other object that the LHS matches, then the RHS of these rules updates to subtract the number required for a free item.

On Tue, Jan 27, 2009 at 9:41 AM, niraj manandhar <regniraj@gmail.com> wrote:



Dear Sir
Thanks for the answer by the way is there any way to slove my free item problem .

I want to make a decison table  in excel where my client will fill in  the item and free item list  as


Purchased ITem             No of purchase                 Free Item         No of free
==========================================================
Pen                                2                                     Rubber                 1
Pen                                5                                    Pencil                   1
Pen                               10                                   Pencil                   3
Pen                               12                                   Pencil                   4
Ink bottle                        3                                     Sticker                   1
Ink bottle                        5                                    Sticker                   2
Ink Bottle                       10                                     Sticker                  5


When a customer buys     19 pen then
his free item will be
4  pencil (due to first 12 pens)
5 pencil (due to remaining 5 pens)
1 rubber (due to  2 pens)

I have been trying to write the rule and fit into excel since from 1 week but due to my limited knowledge of drl and decision tables in excel it is taking a lot of time than writing code with lookup table and JAVA if else

Please help me to slove this riddle



Thanks
Niraj







_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users