Hi,
I have a slightly tricky problem on my hand that i am trying to solve using
rules.
I am using version 5.1 of Drools.Appreciate if there are any suggestions /
pointers .
I have a customer who will have a shopping cart with various products. For
example
the shopping cart will be a list of products that belong to a certain
sub-category and
super category like
product-id= 'Noodles', sub-category='PackagedFood',
super-category='FMCG-Food',
%value of total=3%
product-id= 'Cookies',
sub-category='PackagedFood',super-category='FMCG-Food',
%value of total=6%
product-id= 'Pizza',
sub-category='ReadyToEat',super-category='FMCG-Food',
%value of total=5%
product-id= 'Burgers',
sub-category='ReadyToEat',super-category='FMCG-Food',
%value of total=7%
product-id= 'Shampoo',
sub-category='Toiletaries',super-category='FMCG-NonFood',
%value of total=4%
product-id= 'Conditioner',
sub-category='Toiletaries',super-category='FMCG-NonFood', %value of
total=8%
The customer will also have a suggested cart that serves as a reference at the
sub-category and supercategory level. The reference will tell what level of his
total purchase he can spend on the sub-category and super-category. The
reference will look something like
super-category='FMCG-Food', %value-suggested=20%
super-category='FMCG-NonFood', %value-suggested=15%
sub-category='PackagedFood',%value-suggested=10%
sub-category='ReadyToEat',%value-suggested=10%
sub-category='Toiletaries',%value-suggested=6%
Looking at this example the customer is going overboard in the FMCG-Food super
category as the suggested
limit is 20% and the actual grouped at the supsercategory is 21% . Also he is
crossing the limit at the
sub-category level for ReadyToEat (suggested is 10% vs actual is 12%) and
Toiletaries (suggested is 6% vs actual 12%)
My problem is how do i group the actual data at various supercategory level,
sum the %value and then compare it with the suggested in the when clause.
If they cross the limit i will then have some action taken in the then clause.
Similarly i will have to do the same at the sub-category level as well.
Regards,
Manav