<div>Hi Krishnan,</div> <div>I need the functionality of being able to call methods of a global class in the 'then' piece of the drl. I had defined the drl file as:</div> <div> </div> <div>package test.tools.rulesengine</div> <div>import test.tools.rulesengine.Utilities;</div> <div>global test.tools.rulesengine.Utilities util;</div> <div> </div> <div>rule "Rule1".................</div> <div> </div> <div>When I debug the 'when' piece, I see that the method to check the name is being called, but tfter that, the global util's class method is not called. Any pointers would be helpful.</div> <div> </div> <div>Thanks,</div> <div>Smitha<BR><BR><B><I>Krishnan <krishiyer@gmail.com></I></B> wrote:</div> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi Smitha, <BR><BR>Rewrite the rule as follows :- <BR><BR> <DIV><FONT size=2>rule "Rule1"</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 "POS-RPT_0_1" ) <BR>then <BR></FONT></DIV> <DIV><FONT size=2>$Position.setColor("red");<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> <<A href="mailto:bhat_smitha@yahoo.com">bhat_smitha@yahoo.com</A>> wrote:</SPAN> <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"> <DIV>Hi,</DIV> <DIV>I am new to JBoss rules. I have a .drl as given below:</DIV> <DIV> </DIV><FONT size=2></FONT> <DIV><FONT size=2>rule "Rule1"</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 "POS-RPT_0_1")</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, "red");</FONT></DIV><FONT size=2></FONT> <DIV><FONT size=2>end</FONT></DIV><FONT size=2></FONT> <DIV><FONT size=2></FONT> </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> </DIV><FONT size=2></FONT> <DIV><FONT size=2>posIn = new
Position(name,<BR> id,<BR> symbolCode,<BR> lonDouble,<BR> latDouble,<BR> elevDouble,<BR> reportDate,<BR> this);<BR> workingMemory.assertObject ( posIn );<BR> workingMemory.fireAllRules(); </FONT></DIV><FONT size=2></FONT> <DIV><FONT size=2></FONT> </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> </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 "contains", 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> </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> </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 class=ad> <DIV> </DIV></SPAN></FONT></FONT><SPAN class=ad> <div></div> <HR
SIZE=1> Looking for a deal? <A onclick="return top.js.OpenExtLink(window,event,this)" href="http://us.rd.yahoo.com/evt=47094/*http://farechase.yahoo.com/;_ylc=X3oDMTFicDJoNDllBF9TAzk3NDA3NTg5BHBvcwMxMwRzZWMDZ3JvdXBzBHNsawNlbWFpbC1uY20-" target=_blank>Find great prices on flights and hotels</A> with Yahoo! FareChase. <div></div></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 _______________________________________________<BR>rules-users mailing
list<BR>rules-users@lists.jboss.org<BR>https://lists.jboss.org/mailman/listinfo/rules-users<BR></BLOCKQUOTE><BR><p> 
<hr size=1>Need a vacation? <a href="http://us.rd.yahoo.com/evt=48256/*http://travel.yahoo.com/;_ylc=X3oDMTFhN2hucjlpBF9TAzk3NDA3NTg5BHBvcwM1BHNlYwNncm91cHMEc2xrA2VtYWlsLW5jbQ--">Get great deals
to amazing places </a>on Yahoo! Travel.