hi smitha, <br><br>did not understand what you were trying to do ?. can you send me a code snippet along with the drl file and I will be able to help you better . <br><br>thanks, <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="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 '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<div><span class="e" id="q_1133f559e249ad7d_1"><br><br><b><i>Krishnan <<a href="mailto:krishiyer@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
krishiyer@gmail.com</a>></i></b> wrote:</span></div></div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;"><div><span class="e" id="q_1133f559e249ad7d_3">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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
bhat_smitha@yahoo.com</a>> 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> </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> <div> </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 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">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. <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