[rules-users] Drools Rule Engine - Tiered Rates

Swindells, Thomas TSwindells at nds.com
Wed Jun 30 08:26:24 EDT 2010


You can do what you like, it is how you express it which is the challenge...

What you seem to be saying is that your model is wrong, you don't have a concept of "a rate", you instead have the concept of multiple rates and your model needs to reflect this.
What happens for the case of 2500? Will this have the first 1000 as 10%, next 1000 at 20% and next 500 as 30% etc...
Your model is probably also going to reflect what work you actually want to perform and get out at the end.
With the above scenario you have two options:
If you want to know which rates apply you would probably just have your rules check min units and add all the rates to a list (perhaps expanded to say their range).
If you don't actually care about the rates you may be able to design your rules so that each fires and just adds the required tax amount onto a accumulator value.

Thomas

> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of ramram
> Sent: 30 June 2010 11:54
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] Drools Rule Engine - Tiered Rates
>
>
> Hi Greg,
>
>   Thnx 4 the mail that u have sent. It was really helpful in how can we
> implement a Tiered rate concept using Drools Rule Engine. I have a question
> concerning the mail that u sent and i would like to ask u if it can be
> implemented:
>
> {
>       Object rate = rateType.newInstance();
>       rateType.set( rate, "minUnits", 0 );
>         rateType.set( rate, "maxUnits", 1000 );
>       rateType.set( rate, "revenuePercent", 10 );
>       ksession.insert(rate);
> }
> {
>       Object rate = rateType.newInstance();
>       rateType.set( rate, "minUnits", 1001 );
>       rateType.set( rate, "maxUnits", 2000 );
>       rateType.set( rate, "revenuePercent", 20 );
>       ksession.insert(rate);
> }
>
> {
>       Object sale = saleType.newInstance();
>       saleType.set( sale, "units", 1500 );
>       ksession.insert(sale);
> }
>
>    In this case 1500 will have a percentage of 20% because the value is
> between 1001 and 2000 but in fact the following must occur (1000 should have
> 10% and the remaining 500 should have 20%  ). Can we implement this is
> Drools Rule Engine.
>
>
> Regards,
> Ram
> --
> View this message in context: http://drools-java-rules-
> engine.46999.n3.nabble.com/Drools-Rule-Engine-Tiered-Rates-
> tp882038p932913.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


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************




More information about the rules-users mailing list