Hi,<br><br>&nbsp; I am new to Drools and working with 4.0.1 version.<br>&nbsp; I am playing with DSL and having trouble with conditional field constraints. <br>&nbsp; I really appreciate any help, i like drools a lot and would love to use it.
<br><br>&nbsp; Here is the simple rule i have:<br><br><div style="margin-left: 40px; color: rgb(102, 102, 102);">rule &quot;Credit Approved&quot; <br>&nbsp;&nbsp;&nbsp; salience 5<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //notice here we are using our own domain specific language that&#39;s defined within
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #credit.dsl file<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; There is a person with<br><span style="background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #-must has a name</span><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -age is at least 18 years old<br>&nbsp;&nbsp;&nbsp; then <br>&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println( &quot;[ALLOW] Credit approved for &quot; + person.getName());<br>end<br></div><br>&nbsp; Here is my dsl definition:<br><div style="margin-left: 40px;">
[when]There is a person with=person:Person()<br>[when]-age is at least {age} years old=(age &gt;= {age})<br>[when]-age is less than {age} years old=(age &lt; {age})<br>[when]-must has a name=(name != &quot;&quot; &amp;&amp; name != null)
<br>[when]-id must be positive integer=id &gt; 0<br><br></div>Everything works fine if i use only &#39;age is least 18 years old&#39; or &#39;must has a name&#39;.<br>However, if i try to do a connective and between these two constraints, i am getting
<br>&nbsp;package build errors:<br><div style="margin-left: 40px;"><span style="background-color: rgb(255, 255, 255);">Package build error found:</span><br><span style="background-color: rgb(255, 255, 255);">[13,43]: unknown:13:43 mismatched token: [@59,331:331=&#39;,&#39;,&lt;11&gt;,13:43]; expecting type RIGHT_PAREN[13,59]: unknown:13:59 mismatched token: [@71,347:347=&#39;)&#39;,&lt;12&gt;,13:59]; expecting type THEN
</span><br><span style="background-color: rgb(255, 255, 255);">Exception in thread &quot;main&quot; org.drools.rule.InvalidRulePackage: [13,43]: unknown:13:43 mismatched token: [@59,331:331=&#39;,&#39;,&lt;11&gt;,13:43]; expecting type RIGHT_PAREN[13,59]: unknown:13:59 mismatched token: [@71,347:347=&#39;)&#39;,&lt;12&gt;,13:59]; expecting type THEN
</span><br><span style="background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp; at org.drools.rule.Package.checkValidity(Package.java:419)</span><br><span style="background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractRuleBase.addPackage
(AbstractRuleBase.java:292)</span><br><span style="background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp; at com.trg.play.rules.PersonTest.readRule(PersonTest.java:103)</span><br><span style="background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp; at 
com.trg.play.rules.PersonTest.main(PersonTest.java:51)</span><br><span style="background-color: rgb(255, 255, 255);"></span></div><br>
I have attached my test program for your review.<br><br>