What about ksession.getGlobals().get(&quot;obj&quot;)?<div><br></div><div>Best Regards,<br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>

- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">On Wed, Feb 9, 2011 at 12:24 PM, gs76pl <span dir="ltr">&lt;<a href="mailto:gstasica@pacemetrics.com">gstasica@pacemetrics.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
hi,<br>
<br>
is it possible to check if a rule has been defined with a global as below?<br>
<br>
global MyObject obj;<br>
<br>
rule<br>
when<br>
then<br>
<br>
Basically, i&#39;m running below code:<br>
ksession = kbase.newStatefulKnowledgeSession();<br>
ksession.setGlobal(&quot;obj&quot;, new MyObject());<br>
<br>
but if a rule doesn&#39;t have global definition my code throws an exception.<br>
What i&#39;d like to do is something like<br>
ksession.getGlobal(&#39;&quot;obj&quot;) or ksession.checkGlobalExist(&#39;&quot;obj&quot;).<br>
Unfortunately the first method doesn&#39;t work as it doesn&#39;t check if a global<br>
has been declared in a rule<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-global-has-been-declared-in-a-rule-tp2459143p2459143.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-global-has-been-declared-in-a-rule-tp2459143p2459143.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></div>