Hi,

 

I hope holiday season is bringing a lot of happiness for all of us.

 

I am wondering if there is a way to implement the following. If Rule1 is
satisfied, Rule 2 should not be evaluated.

 

e.g., In the example below if the "GreaterThan10" rule is satisfied,
"GreaterThan5" rule should not be applied.  The reason being I want to
return the consequence from the first rule satisfying the condition.

 

<rule-set name="RuleSet1"

    xmlns="http://drools.org/rules";    

    xmlns:java="http://drools.org/semantics/java";

    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";

    xs:schemaLocation="http://drools.org/rules rules.xsd

 
http://drools.org/semantics/java java.xsd">

 

 

    <import>java.lang.String</import>

 

    <rule name="GreaterThan10" salience="100">

        <parameter identifier="number">

            <class>String</class>

        </parameter>

        <java:condition>Integer.parseInt(number) &gt; 10
</java:condition>                

        <java:consequence> System.out.println("Greater than 10 rule
satisfied"); </java:consequence>

    </rule>

 

 

    <rule name="GreaterThan5" salience="50">

        <parameter identifier="number">

            <class>String</class>

        </parameter>

        <java:condition>Integer.parseInt(number) &gt; 5
</java:condition>                

        <java:consequence> System.out.println("Greater than 5 rule
satisfied"); </java:consequence>

    </rule>    

    

</rule-set>

 

Thanks in advance.

 

Amitesh Sinha

 

Technical Architect

Telecom Business Unit

Patni Computer Systems

[EMAIL PROTECTED]

 

Reply via email to