<br>        Drools explicitly disables control statements in MVEL consequences, at it is usually not a good sign. I.e., you should probably encapsulate that check you are doing in a LHS condition (even if you have to wrap it up in an eval()), so that the rule will not be activated and fired when it shouldn&#39;t.<br>
<br>        Edson<br><br><div class="gmail_quote">2009/11/3 Shah, Malay <span dir="ltr">&lt;<a href="mailto:Malay.Shah@morganstanley.com">Malay.Shah@morganstanley.com</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>
<div>
<div><span><font face="Verdana" size="2">Hi 
All,</font></span></div>
<div><span><font face="Verdana" size="2"></font></span> </div>
<div><span><font face="Verdana" size="2">I am trying to 
compile a drool rule using MVEL dialect and getting the following weird error. 
</font></span></div>
<div><span><font face="Verdana" size="2"></font></span> </div>
<div><span><font size="2" color="#ff0000"><font size="2" color="#ff0000"><font size="2" color="#ff0000"><font size="2" color="#ff0000">
<p align="left">Unable to determine the used declarations.</p>
<p align="left">unbalanced braces (near code: &lt;&lt; ... core1_entityOID); 
...&gt;&gt;) (position: 33) : [Rule name=Legacy ETSDB Rule, agendaGroup=MAIN, 
salience=0, no-loop=false]</p></font></font><u><font size="2" color="#000080"><font size="2" color="#000080">
<p>org.mvel.ParseException</p></font></font></u></font></font><font size="2" color="#ff0000"><font size="2" color="#ff0000">: unbalanced braces (near code: &lt;&lt; ... 
core1_entityOID); ...&gt;&gt;) (position: 33)Unable to build expression for 
&#39;consequence&#39;</font></font><font size="2" color="#ff0000"><font size="2" color="#ff0000"></font></font></span></div>
<div><font size="2" color="#ff0000"><font face="Verdana" size="2" color="#ff0000"></font></font><font size="2" color="#ff0000"><font size="2" color="#ff0000"><font face="Verdana"></font></font></font> </div>
<div><span><font face="Verdana" size="2">The code I am 
trying to compile is:</font></span></div>
<div><font face="Verdana" size="2" color="#ff0000"></font> </div>
<div><font size="2"><font size="2"><font face="Verdana" color="#0000ff">package 
S_124<br>import com.ms.ieddata.dataQuality.violation.Violation;<br>import 
com.ms.ieddata.etsdb.model.EtsExecution_core;<br>import 
com.ms.ieddata.etsdb.model.EtsExecutionOrder_core;<br>global java.util.HashSet 
violations;<br>global java.util.HashSet 
violationKeys;</font></font></font></div><font><font><font>
<div><br><font face="Verdana" size="2" color="#0000ff">dialect &quot;mvel&quot;</font></div>
<div><font face="Verdana" size="2"></font><br><font face="Verdana" size="2" color="#0000ff">rule &quot;Legacy ETSDB Rule&quot;</font></div>
<div><br><font face="Verdana" size="2" color="#0000ff">when<br>EtsExecution_core1:EtsExecution_core(crossInd == &quot;1&quot; , 
lastCapacity != &quot;3&quot; , lastDestinationID not in 
(&quot;EUREX&quot;,&quot;IDEM&quot;,&quot;MEFF&quot;,&quot;LIFFE&quot;))<br>EtsExecutionOrder_core1:EtsExecutionOrder_core(entityOID 
== EtsExecution_core1.parentOID , exDestination in (&quot;I&quot;,&quot;L&quot;) , swapComponentType 
!= &quot;swaps&quot; , orderCapacity not in 
(&quot;D&quot;,&quot;R&quot;,&quot;X&quot;,&quot;L&quot;,&quot;E&quot;,&quot;T&quot;,&quot;C&quot;,&quot;O&quot;,&quot;P&quot;,&quot;S&quot;),EtsExecutionOrder_core1_entityOID:entityOID,EtsExecutionOrder_core1_application:application,EtsExecutionOrder_core1_entityVID:entityVID)</font></div>

<div><br><font face="Verdana" size="2" color="#0000ff">then</font></div>
<div><br><font face="Verdana" size="2" color="#0000ff">String 
key=&quot;S-124_EtsExecution_core&quot; + &quot;_entityVID_&quot; + 
&quot;EtsExecutionOrder_core1_entityVID&quot; + &quot;_application_&quot; + 
&quot;EtsExecutionOrder_core1_application&quot; + &quot;_entityOID_&quot; + </font></div>
<div><font face="Verdana" size="2" color="#0000ff">&quot;EtsExecutionOrder_core1_entityOID&quot;;</font></div>
<div><br><font face="Verdana" size="2" color="#0000ff">vPresent = 
violationKeys.contains(key);</font></div>
<div><br><font face="Verdana" size="2" color="#0000ff">if (!vPresent)<br>{<br><span>    </span> violation = new 
Violation();<br><span>    </span> violation.putRuleActionAttribute(&quot;ruleId&quot;,&quot;S-124&quot;);<br><span>    </span> violation.putRuleActionAttribute(&quot;ruleName&quot;,&quot;Legacy 
ETSDB Rule&quot;);<br><span>    </span> violation.putRuleActionAttribute(&quot;legacyRuleType&quot;,&quot;1&quot;);<br><span>    </span> violation.putRuleActionAttribute(&quot;entityName&quot;,&quot;EtsExecution_core&quot;);<br>
<span>    </span> violation.putRuleActionAttribute(&quot;fieldName&quot;,&quot;Field&quot;);<br><span>    </span> violation.putRuleActionAttribute(&quot;entityVID&quot;,EtsExecutionOrder_core1_entityVID);<br><span>    </span> violation.putRuleActionAttribute(&quot;application&quot;,EtsExecutionOrder_core1_application);<br>
<span>    </span> violation.putRuleActionAttribute(&quot;entityOID&quot;,EtsExecutionOrder_core1_entityOID);<br>}</font></div></font></font></font></div>
<div><font face="Verdana" size="2" color="#0000ff"></font> </div>
<div><font size="2"><font size="2"><font face="Verdana" color="#0000ff">end</font></font></font></div>
<div><font face="Verdana" size="2"></font> </div>
<div><span><font face="Verdana" size="2">The 
code works fine when I use java dialect. Also, if I remove the if statement 
from consequence, the code get compiled in mvel and java dialects. Am I missing 
something obvious here? I am using drools 4.0.1.</font></span></div>
<div><span><font face="Verdana" size="2"></font></span> </div>
<div><span><font face="Verdana" size="2">Thanks</font></span></div>
<div><font face="Verdana" size="2"></font> </div>
<div style="color: black; font-family: arial;"><span style="font-size: 10pt;">Malay Shah<br></span><span style="font-weight: bold; font-size: 7.5pt;">Morgan Stanley | IDEAS Practice 
Areas<br></span><span style="font-weight: normal; font-size: 7.5pt;">750 Seventh 
Avenue, 6th Floor | New York, NY  10019<br>Phone: +1 212 
762-4495<br><a href="mailto:Malay.Shah@morganstanley.com" target="_blank">Malay.Shah@morganstanley.com</a><br></span></div>
<div><font face="Verdana" size="2"></font> </div></div>
<div>
<hr>
</div>
<p style="margin: 0in 0in 0pt; text-indent: 0in;"><span style="font-size: 8pt; color: gray;"><font face="Arial" size="1" color="gray">NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We<span style="font-size: 7.5pt; color: gray;"> may monitor and store emails to the extent permitted by applicable law.</span></font></span></p>

<div></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 by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>