You can do this using the "extends" keyword in your rule.

 

Rule "shopping cart total exceeds 4000, give 50% discount"
       when
         <condition>
       then
         <action>       
end

 

Rule "if order between 6 to 9 pm give additional discount of 20 %" extends "shopping cart total exceeds 4000, give 50% discount"

       when
               <condition>
       then
               <action>
end

 

You can also disable the first rule and just use "extends" to limit the amount of duplicate conditions in your rules. Note extends basically copies the conditions from the first rule to what is being extended, but I believe it will do what you are trying to do.



Michael Rhoden
VP - IT Development
Franklin American Mortgage Company
Direct: 615-778-1117
Fax: 615-778-2766
Email: mrhoden@franklinamerican.com

----- Original Message -----
From: "Pardeep Ruhil" <Pardeep.Ruhil@lntinfotech.com>
To: rules-users@lists.jboss.org
Sent: Wednesday, August 12, 2009 2:44:38 PM GMT -06:00 US/Canada Central
Subject: [rules-users] How to create nested rules in Drool Guvnor

Hi,
Thanks for replying.

I have a scenario like
Rule "shopping cart total exceeds 4000, give 50% discount"
       when
         <condition>
       then
         <action>
         call Rule"if order is  between 6 to 9 pm, give additional
discount of 20 %"
end
Rule "if order between 6 to 9 pm give additional discount of 20 %"
       when
               <condition>
       then
               <action>
end

..............
Also i have a  query like, Can we make rule like this

Rule "shopping cart total exceeds 4000 give 50% discount"
       when
               <condition>
       then
               <action>

               Rule "if order between 6 to 9 pm give additional discount
of 20 %"
                       when
                               <condition>
                       then
                               <action>
               end
end

Can we make rules like above?


Thanks & Regards

Pardeep Ruhil
This email may contain confidential or privileged information for the intended recipient(s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. Thanks

______________________________________________________________________

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