You can also try a data driven approach:

declare Rate
    minUnits : int
    maxUnits : int 
    revenuePercent : int
end

declare Sale
    units : int
end

rule "FindRate"
    when
        r : Rate( ) 
        s : Sale( units > r.minUnits, units < r.maxUnits )
    then
        System.out.println( "revenuePercent for " + s + " is " + 
r.getRevenuePercent());
end

Sample code attached.

--- On Wed, 6/9/10, Esteban Aliverti <[email protected]> wrote:

From: Esteban Aliverti <[email protected]>
Subject: Re: [rules-users] Drools Rule Engine - Tiered Rates
To: "Rules Users List" <[email protected]>
Date: Wednesday, June 9, 2010, 7:45 AM

Did you take a look at 
drools-template?http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d4e3346


Best,

On Wed, Jun 9, 2010 at 9:24 AM, ramram <[email protected]> wrote:




Hi All,



   I have the following question regarding Drools. The possibility to

implement tiered rates and that is I have the following example.

   If the total units sold is between 0 - 1000 item a revenue return is 10%

while if the total units sold is between 1001- 2000 items the return is 20%.



   I want to use 1 dynamic rule to implement the above example rather than

having 2 static rules defined? is this possible through drools?





Regards

Ram

--

View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Rule-Engine-Tiered-Rates-tp882038p882038.html



Sent from the Drools - User mailing list archive at Nabble.com.

_______________________________________________

rules-users mailing list

[email protected]

https://lists.jboss.org/mailman/listinfo/rules-users




-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti



-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users



      

Attachment: DroolsTest.java
Description: Binary data

Attachment: Sample.drl
Description: Binary data

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to