[rules-users] Evaluate rules for multiple facts of the same type within a StateuflSession

pdario dario.piantanida at gmail.com
Tue Feb 19 05:15:12 EST 2013


laune wrote
> I'm confident that there's a clean and manageable way of preparing
> this data to work in combination with a small and constant set of
> rules.  I refrain from elaborating this in all details without knowing
> all of the requirements.

I'll try to summarize them as properly as I can...

Rule 0: default condition
If cart is paid "offline", it has 0% discount

Rule 1: online payment discount
If cart is paid "online", it has 10% discount

These two are fixed and always valid.

Then we monthly decide a list of items that grant different discounts on the
whole cart over the 10% of Rule 1 (i.e. Rule 1 must be true to get further
discount).

For example:
Rule 2: valid for February 2013, item A
If cart is paid "online" and contains item A, it has 15% discount
Rule 3: valid for February 2013, item B
If cart is paid "online" and contains item B, it has 17% discount

Next month, both items and discount levels will change

We need the firt Rule 0 because the user can change the payment method, so
we have to reset the discount to 0.

Ideally, we would like to left the Rule 0 and 1 unchanged (as they are basic
rule) and manage the monthly rules without impact on them.

To make things worse, our business people not only rely on items contained
in the cart, but each month they decide a different attribute from the cart
or user to be taken into account for special discount, so that the examples
above may read like:

Rule 2: valid for February 2013, item A
If cart is paid "online" and contains item A and the user is older than 30,
it has 15% discount
Rule 3: valid for February 2013, item B
If cart is paid "online" and contains item B and the cart is shipped within
Europe, it has 17% discount

As you remember, we used salience and activation groups, but this prevents
us from applying rules to a bunch of carts, as the rule activation cancels
other activations.

Do you see a cleaner design?

Thank you a lot for support.



--
View this message in context: http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022441.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list