<div dir="ltr"><br>&nbsp;&nbsp; You syntax is wrong. Fixing your syntax is as easy as saying:<br><br>exists ExamDetail( authLimit != null )<br><br>&nbsp;&nbsp; But I think that your rules can be simplified by simply writing:<br><br>rule &quot;Rule n.1&quot;<br>

dialect &quot;mvel&quot;<br>
no-loop true<br>
salience 10<br>
 &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp;&nbsp; $examDetail : ExamDetail( $value: value &lt; authLimit);<br>
 &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;1 Exam passed!&quot; + $value);<br>
end<br>
<br>
rule &quot;Rule n.2&quot;<br>
dialect &quot;mvel&quot;<br>
no-loop true<br>
salience 10<br>
 &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;not ExamDetail( value &lt; authLimit );<br>
 &nbsp;&nbsp; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;2 Exam passed! + $value);<br>
end<br>
<br><br>&nbsp;&nbsp; This should cover both of your scenarios.<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/9/12 Nicola Benaglia <span dir="ltr">&lt;nicola.benaglia@tecno-progetti.eu&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;">
Hi,<br>
I am moving my first steps with Drools <a href="http://4.0.7." target="_blank">4.0.7.</a><br>
<br>
In my case I have an exam result to valuate.<br>
I can pass an ExamDetailas fact containing (value, authLimit, lawLimit)<br>
where authLimit may or may not be present.<br>
<br>
How can I force to valuate a rule only if a property exists?<br>
<br>
Here an example:<br>
<br>
rule &quot;Rule n.1&quot;<br>
dialect &quot;mvel&quot;<br>
no-loop true<br>
salience 10<br>
 &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp; exists ExamDetail(authLimit);<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$examDetail : ExamDetail( $value: value &lt; authLimit);<br>
 &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;1 Exam passed!&quot; + $value);<br>
end<br>
<br>
rule &quot;Rule n.2&quot;<br>
dialect &quot;mvel&quot;<br>
no-loop true<br>
salience 10<br>
 &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;not exists ExamDetail(authLimit);<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ExamDetail( $value: value &lt; lawLimit);<br>
 &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;2 Exam passed! + $value);<br>
end<br>
<br>
<br>
With these 2 rules I expected to cover my 2 cases:<br>
1) When I have authLimit &nbsp;--&gt; rule #1<br>
2) When authLimit is absent --&gt; rule #2<br>
<br>
But I get this error (when I don&#39;t have authlimit):<br>
<br>
Exception in thread &quot;main&quot; org.drools.rule.InvalidRulePackage: [14,21]:<br>
unknown:14:21 Unexpected token &#39;authLimit&#39;[25,6]: unknown:25:6<br>
Unexpected token &#39;exists&#39;[25,24]: unknown:25:24 Unexpected token &#39;authLimit&#39;<br>
 &nbsp; &nbsp;at org.drools.rule.Package.checkValidity(Package.java:424)<br>
 &nbsp; &nbsp;at<br>
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)<br>
 &nbsp; &nbsp;at eu.tecnoprogetti.rules.seam.ExamCheck.main(ExamCheck.java:23)<br>
<br>
<br>
Any suggestions?<br>
Thank you for your time.<br>
Nico<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>
</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>