<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2>Edson,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2>Thanks for the tip. I figured I'd need to use a workaround
like this.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2>Unfortunately I'm under a series of tight development and
test deadlines all the way into early summer. Otherwise, I'd have a look.
Hopefully someone else out there can assist.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=413435613-13102008><FONT face=Arial
color=#0000ff size=2>-A</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Edson
Tirelli<BR><B>Sent:</B> Friday, October 10, 2008 5:46 AM<BR><B>To:</B> Rules
Users List<BR><B>Subject:</B> Re: [rules-users] No globals in
functions?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr><BR> Allen,<BR><BR> 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> foo(
log, someString );<BR>end<BR><BR> If you or anyone would like to
help improving this, let us know and we can discuss ways into doing it.
<BR><BR> []s<BR> Edson<BR><BR>
<DIV class=gmail_quote>2008/10/9 Bagwell, Allen F <SPAN dir=ltr><<A
href="mailto:afbagwe@sandia.gov">afbagwe@sandia.gov</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV><FONT face="Arial, sans-serif" size=3>
<DIV> </DIV>
<DIV><FONT size=2>There's probably an easy explanation for this. I was
wondering about why functions inside of rule files can't access
globals?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>For example, I have a log4j logger that I pass into my rule
files via a global. The logger should never be a part of working memory.
It's just there to capture valuable feedback.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>But I can't do this:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>global Logger log;</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>function void foo(String cond)</FONT></DIV>
<DIV><FONT size=2>{</FONT></DIV>
<DIV><FONT size=2> if (cond == "error")</FONT></DIV>
<DIV><FONT size=2> log.error("I saw an
error");</FONT></DIV>
<DIV><FONT size=2>}</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Because the compiler says that in the function it can't
resolve 'log'.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>-A</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Tahoma, sans-serif" color=#008080 size=2>Allen F.
Bagwell</FONT></DIV>
<DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1>e-mail: <A
href="mailto:afbagwe@sandia.gov"
target=_blank>afbagwe@sandia.gov</A></FONT></DIV>
<DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1>phone:
505/284-4517</FONT></DIV>
<DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1>fax: 505/
844-7886</FONT></DIV>
<DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1></FONT> </DIV>
<DIV style="MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt"><FONT
face="Tahoma, sans-serif" color=#008080 size=1>There is no monument dedicated
to the memory of a committee. -- Lester J. Pourciau</FONT></DIV>
<DIV><FONT face="Tahoma, sans-serif" size=1></FONT> </DIV>
<DIV><FONT face="Tahoma, sans-serif" size=1></FONT> </DIV>
<DIV><FONT
size=2></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> Edson Tirelli<BR> JBoss Drools Core
Development<BR> JBoss, a division of Red Hat @ <A
href="http://www.jboss.com">www.jboss.com</A><BR></DIV></BODY></HTML>