<div dir="ltr"><br>&nbsp;&nbsp; Allen,<br><br>&nbsp;&nbsp; There is a technical explanation behind that and we never had the time to find a way to overcome this limitation. What you can do, although not ideal, is to send the global as a parameter:<br>
<br>funcion void foo( Logger log, String cond ) <br>{<br>...<br>}<br><br>rule XYZ<br>when<br>then<br>&nbsp;&nbsp;&nbsp; foo( log, someString );<br>end<br><br>&nbsp;&nbsp; If you or anyone would like to help improving this, let us know and we can discuss ways into doing it. <br>
<br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/10/9 Bagwell, Allen F <span dir="ltr">&lt;<a href="mailto:afbagwe@sandia.gov">afbagwe@sandia.gov</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">







<div>
<font size="3" face="Arial, sans-serif">
<div>&nbsp;</div>
<div><font size="2">There&#39;s probably an easy explanation for this. I was wondering about why functions inside of rule files can&#39;t access globals?</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">For example, I have a log4j logger that I pass into my rule files via a global.&nbsp; The logger should never be a part of working memory. It&#39;s just there to capture valuable feedback.</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">But I can&#39;t do this:</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">global Logger log;</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">function void foo(String cond)</font></div>
<div><font size="2">{</font></div>
<div><font size="2">&nbsp;&nbsp; if (cond == &quot;error&quot;)</font></div>
<div><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.error(&quot;I saw an error&quot;);</font></div>
<div><font size="2">}</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">Because the compiler says that in the function it can&#39;t resolve &#39;log&#39;.</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">-A</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font color="#008080" size="2" face="Tahoma, sans-serif">Allen F. Bagwell</font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">e-mail:&nbsp; <a href="mailto:afbagwe@sandia.gov" target="_blank">afbagwe@sandia.gov</a></font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">phone:&nbsp; 505/284-4517</font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">fax:&nbsp; 505/ 844-7886</font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">&nbsp;</font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt;"><font color="#008080" size="1" face="Tahoma, sans-serif">There is no monument dedicated to the memory of a committee. -- Lester J. Pourciau</font></div>
<div><font size="1" face="Tahoma, sans-serif">&nbsp;</font></div>
<div><font size="1" face="Tahoma, sans-serif">&nbsp;</font></div>
<div><font size="2">&nbsp;</font></div>
</font>
</div>

<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>
<br></blockquote></div><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>