[rules-users] Drools Rule Engine - Tiered Rates

Greg Barton greg_barton at yahoo.com
Wed Jun 9 14:42:40 EDT 2010


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 <esteban.aliverti at gmail.com> wrote:

From: Esteban Aliverti <esteban.aliverti at gmail.com>
Subject: Re: [rules-users] Drools Rule Engine - Tiered Rates
To: "Rules Users List" <rules-users at lists.jboss.org>
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 <ramram858 at gmail.com> 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

rules-users at lists.jboss.org

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




-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti



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

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



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100609/47495f36/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DroolsTest.java
Type: application/octet-stream
Size: 2303 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100609/47495f36/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sample.drl
Type: application/octet-stream
Size: 307 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100609/47495f36/attachment-0001.obj 


More information about the rules-users mailing list