Another approach would be to use a transient Fact for the &quot;local variable&quot;:-<br><br>rule &quot;1&quot;<br>when<br>
        #some condition01<br>
then<br>
        insertLogical( new MyFact(200) );<br>
end<br>
<br>rule &quot;2&quot;<br>
when<br>
       #some condition02<br>
then<br>

        insertLogical( new MyFact(300) );<br>

end<br>
<br>rule &quot;3&quot;<br>
when<br>
     #some condition03<br>     MyFact( $v : value )<br>
then<br>
     emp.salary=$v+2000<br>
end<br><br>Of course if Rule &quot;1&quot; and Rule &quot;2&quot; both inserted an instance of MyFact Rule &quot;3&quot; would activate twice. This can be safe-guarded against by checking for the non-existence of MyFact:-<br>
<br>rule &quot;1&quot;<br>
when<br>

        #some condition01<br>        not MyFact()<br>

then<br>

        insertLogical( new MyFact(200) );<br>

end<br>

<br>
rule &quot;2&quot;<br>

when<br>

       #some condition02<br>

        not MyFact()<br>


then<br>


        insertLogical( new MyFact(300) );<br>


end<br>

<br>
rule &quot;3&quot;<br>

when<br>

     #some condition03<br>
     MyFact( $v : value )<br>

then<br>

     emp.salary=$v+2000<br>

end<br>
<br>
If however you then needed this to work on, for example different employees, you&#39;d need to associated MyFact to the employee:-<br>
<br>rule &quot;1&quot;<br>

when<br>


        $e : Employee( position == &quot;grunt&quot; )<br>
        not MyFact( employee == $e )<br>


then<br>


        insertLogical( new MyFact(200, $e) );<br>


end<br>


<br>

rule &quot;2&quot;<br>


when<br>





        $e : Employee( position == &quot;manager&quot; )<br>

        not MyFact( employee == $e )<br>



then<br>



        insertLogical( new MyFact(300) );<br>



end<br>


<br>

rule &quot;3&quot;<br>


when<br>


     $e : Employee( position == &quot;grunt&quot; )<br>

     MyFact( $v : value, employee == $e )<br>


then<br>


     modify($e) {<br>          setSalary( $v+2000)<br>     }<br>


end<br>

<br><br><div class="gmail_quote">On 5 October 2012 12:46, joy <span dir="ltr">&lt;<a href="mailto:Kripa_M01@infosys.com" target="_blank">Kripa_M01@infosys.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
i need local variables in drl file.<br>
it should hold integer/double value.<br>
Setting an integer value to a local variable in some rule and getting that<br>
integer value in some other rule<br>
<br>
when<br>
        #some condition01<br>
then<br>
        local variable=200<br>
end<br>
<br>
when<br>
       #some condition02<br>
then<br>
       local variable =300<br>
end<br>
<br>
when<br>
     #some condition03<br>
then<br>
     emp.salary=localvariable+2000<br>
end<br>
<br>
Anyone plz help me to resolve this.<br>
<br>
Thank you<br>
Joy<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Local-Variable-tp4020144.html" target="_blank">http://drools.46999.n3.nabble.com/Local-Variable-tp4020144.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>