<br>To set a global called &quot;prodName&quot; to the value returned by getName() within a rule&#39;s consequence you should use <br>   drools.getWorkingMemory().setGlobal( &quot;prodName&quot;,  getName() );<br>-W<br><br>
<div class="gmail_quote">On 4 November 2010 18:15, rajivharris <span dir="ltr">&lt;<a href="mailto:rajivharris@gmail.com">rajivharris@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi,<br>
I am setting a String variable as global. And trying the access the same in<br>
my Java program. Can anyone help on how to do this.<br>
<br>
code snippet:<br>
global String prodName;<br>
<br>
rule &quot;Your First Rule&quot;<br>
<br>
        when<br>
                #conditions<br>
                eval (true)<br>
        then<br>
                #actions<br>
                prodName= getName();<br>
                System.out.println( &quot;name:&quot; +prodName);<br>
<br>
end<br>
<br>
Thanks,<br>
Rajiv.<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1843203.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1843203.html</a><br>

Sent from the Drools - User 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>
</font></blockquote></div><br>