hi smitha, <br><br>how do you know that setColor() is not getting called ?. Is it because you have a break point inside this method. <br>Let me try this experiment and get back to you about whether it is working for me or not. Also, which version of 
<br>drools are you using ?<br><br>-Krishnan. <br><br><div><span class="gmail_quote">On 6/18/07, <b class="gmail_sendername">Smitha Bhat</b> &lt;<a href="mailto:bhat_smitha@yahoo.com">bhat_smitha@yahoo.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Hi Krishnan,</div>  <div>I need the class itself to be global as I might have to access other functions of it as I go along in the effort. 
</div>  <div>I cannot seem to be able to call the methods of this global class. I have also added a snippet of the code.</div>  <div>&nbsp;</div>  <div>Thanks</div>  <div>&nbsp;Smitha</div>  <div>Here is my drl</div>  <div>&nbsp;</div>  
<div>&nbsp;</div>  <div>drl=</div><font size="1"><span class="q">  <div>package test.tools.rulesengine</div>  <div>import test.tools.rulesengine.Utilities;</div>  <div>global test.tools.rulesengine.Utilities util;</div>  <div>
rule &quot;Rule1&quot;</div></span>  </font><div><font size="1">when</font></div><font size="1">  </font><div><font size="1">$Position1 : PosReport()</font></div><font size="1">  </font><div><font size="1">eval($Position1.getName() == &quot;POS_0_1&quot;)
</font></div><span class="q"><font size="1">  </font><div><font size="1">then</font></div><font size="1">  </font><div></div><font size="1">  </font><div><font size="1">util.setColor($Position1, &quot;red&quot;);</font></div>
<font size="1">  </font><div><font size="1">end</font></div><font size="1">  </font><div><font size="1">&nbsp;</font></div><font size="1">  </font><div></div></span>&nbsp;  <div>&nbsp;</div>  <div>try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;builder.addPackageFromDrl
(new StringReader( drl)
 );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(firstCall){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ruleBase = RuleBaseFactory.newRuleBase();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;ruleBase.addPackage( builder.getPackage() );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;workingMemory = ruleBase.newWorkingMemory();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Utilities util = new Utilities();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;workingMemory.setGlobal(&quot;util&quot;, util);</div>  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;firstCall = false;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;}else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ruleBase.addPackage( builder.getPackage() );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//workingMemory = ruleBase.newWorkingMemory
();<br>&nbsp;&nbsp;&nbsp;&nbsp;} catch (DroolsParserException e1)
 {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TODO Auto-generated catch block<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e1.printStackTrace();<br>&nbsp;&nbsp;&nbsp;&nbsp;} catch (IOException e1) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TODO Auto-generated catch block<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e1.printStackTrace();<br>&nbsp;&nbsp;&nbsp;&nbsp;} catch (Exception e1) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TODO Auto-generated catch block
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e1.printStackTrace();<br>&nbsp;&nbsp;&nbsp;&nbsp;}</div><div><span class="e" id="q_1133f968161f9a7f_5">  <div><br><br><b><i>Krishnan &lt;<a href="mailto:krishiyer@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
krishiyer@gmail.com</a>&gt;</i></b> wrote:</div>  </span></div><blockquote style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;"><div><span class="e" id="q_1133f968161f9a7f_7"><br>Hi Smitha, 
<br><br>They way I understand, in the then clause you would like to call a static function from some class. So, then you can add that to the import and access it directly. It does not have to be global. However, if for some reason you do need to add it as a global,, let me know.
 <br><br>send that when part of the rule again. <br><br>-Krishnan. <br><br>  <div><span class="gmail_quote">On 6/18/07, <b class="gmail_sendername">Smitha Bhat</b> &lt;<a href="mailto:bhat_smitha@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
bhat_smitha@yahoo.com </a>&gt; wrote:</span>  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">  <div>Hi Krishnan,</div>  <div>I need the functionality of being able to call methods of a global class in the &#39;then&#39; piece of the drl. I had defined the drl file as: 
</div>  <div>&nbsp;</div>  <div>package test.tools.rulesengine</div>  <div>import test.tools.rulesengine.Utilities;</div>  <div>global test.tools.rulesengine.Utilities util;</div>  <div>&nbsp;</div>  <div>rule &quot;Rule1&quot;................. 
</div>  <div>&nbsp;</div>  <div>When I debug the &#39;when&#39; piece, I see that the method to check the name is being called, but tfter that, the global util&#39;s class method is not called. Any pointers would be
 helpful.</div>  <div>&nbsp;</div>  <div>Thanks,</div>  <div>Smitha  <div><span><br><br><b><i>Krishnan &lt;<a href="mailto:krishiyer@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> krishiyer@gmail.com
</a>&gt;</i></b> wrote:</span></div></div>  <blockquote style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">  <div><span>Hi Smitha, <br><br>Rewrite the rule as follows :- <br><br>  <div><font size="2">
rule &quot;Rule1&quot;</font></div><font size="2"></font>  <div><font size="2">when</font></div><font size="2"></font>  <div><font size="2">$Position1 : Position ( name matches &quot;POS-RPT_0_1&quot; ) <br>then <br></font>
</div>  <div><font size="2">$Position.setColor(&quot;red&quot;);<br></font><font size="2"></font>  <div><font size="2">end</font></div><font size="2"></font><br>Note : You had something called util, unless it is a global, it will not work. 
<br></div><br>-Krishnan. <br><br> 
 <div><span class="gmail_quote">On 6/18/07, <b class="gmail_sendername">Smitha Bhat</b> &lt;<a href="mailto:bhat_smitha@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> bhat_smitha@yahoo.com
</a>&gt; wrote:</span>   <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">  <div>Hi,</div>  <div>I am new to JBoss rules. I have a .drl as given below: 
</div>  <div>&nbsp;</div><font size="2"></font>  <div><font size="2">rule &quot;Rule1&quot;</font></div><font size="2"></font>  <div><font size="2">when </font></div><font size="2"></font>  <div><font size="2">$Position1 : Position()
</font></div><font size="2"></font>  <div><font size="2">eval($Position1.getName() contains &quot;POS-RPT_0_1&quot;)</font></div><font size="2"></font>  <div><font size="2">then</font></div><font size="2"></font>  <div></div>
<font size="2"></font>  <div><font size="2">util.setColor($Position1, &quot;red&quot;);</font></div><font size="2"></font>  <div><font size="2">end</font></div><font size="2"></font>  <div><font size="2"></font>&nbsp;</div><font size="2">
</font>  <div><font size="2">Before firing the rules, I assert my object as </font></div><font size="2"></font>  <div><font size="2"></font>&nbsp;</div><font size="2"></font>  <div><font size="2">posIn = new Position(name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;symbolCode,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lonDouble,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latDouble,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elevDouble,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reportDate,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this);<br>&nbsp;&nbsp;&nbsp;&nbsp;workingMemory.assertObject ( posIn );<br>&nbsp;&nbsp;&nbsp;&nbsp;workingMemory.fireAllRules(); </font></div><font size="2">
</font>  <div><font size="2"></font>&nbsp;</div><font size="2"></font>  <div><font size="2">I get the following error.</font></div><font size="2"></font>  <div><font size="2"></font>&nbsp;</div><font size="2"><font color="#ff0000" size="2">
 
 <div>org.drools.rule.InvalidRulePackage: Rule Compilation error The left-hand side of an assignment must be a variable Syntax error on token &quot;contains&quot;, invalid AssignmentOperator </div></font><font size="2"></font>
<font color="#ff0000" size="2"></font></font>  <div><font size="2"><font color="#ff0000" size="2">at org.drools.rule.Package.checkValidity(Unknown Source)</font></font></div><font size="2"><font color="#ff0000" size="2"></font>
</font>  <div><font size="2"><font color="#ff0000" size="2">at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)</font></font></div><font size="2"><font color="#ff0000" size="2"></font></font>  <div><font size="2">
<font color="#ff0000" size="2"></font></font>&nbsp;</div><font size="2"><font color="#ff0000" size="2"></font></font>  <div><font size="2"><font color="#ff0000" size="2">What is wrong with my drl? I have a Utilities class that I have defined as global. 
</font></font></div><font size="2"><font color="#ff0000" size="2"></font></font>  <div><font size="2"><font color="#ff0000" size="2"></font></font>&nbsp;</div><font size="2"><font color="#ff0000" size="2"></font></font>  <div>
<font size="2"><font color="#ff0000" size="2">Thanks</font></font></div><font size="2"><font color="#ff0000" size="2"><span>  <div>&nbsp;</div></span></font></font><span>  <div></div>  <hr size="1">  Looking for a deal? <a href="http://us.rd.yahoo.com/evt=47094/*http://farechase.yahoo.com/;_ylc=X3oDMTFicDJoNDllBF9TAzk3NDA3NTg5BHBvcwMxMwRzZWMDZ3JvdXBzBHNsawNlbWFpbC1uY20-" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Find great prices on flights and hotels</a> with Yahoo! FareChase.   <div></div></span><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users 
</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>Sivaramakrishna Iyer Krishnan (Anand) <br><br>Never assume the obvious is true. <br></span></div>- William Safire _______________________________________________ 
<span><br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></span></blockquote><span><br>  <div></div>  <hr size="1">  Need a vacation? <a href="http://us.rd.yahoo.com/evt=48256/*http://travel.yahoo.com/;_ylc=X3oDMTFhN2hucjlpBF9TAzk3NDA3NTg5BHBvcwM1BHNlYwNncm91cHMEc2xrA2VtYWlsLW5jbQ--" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Get
 great deals to amazing places </a>on Yahoo! Travel.   <div></div></span><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users 
</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>Sivaramakrishna Iyer Krishnan (Anand) <br><br>Never assume the obvious is true. <br></span></div>- William Safire _______________________________________________
<span class="q"><br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></span></blockquote><span class="ad"><br><p> 
      </p><hr size="1">Get the Yahoo! toolbar and <a href="http://us.rd.yahoo.com/evt=48225/*http://new.toolbar.yahoo.com/toolbar/features/mail/index.php" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
be alerted to new email </a>wherever you&#39;re surfing. <p></p></span><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" 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>Sivaramakrishna Iyer Krishnan (Anand) <br><br>Never assume the obvious is true. <br>- William Safire