<div dir="ltr"><div>Alright, I kinda found out the cause of the exception I am getting, however I am still struggling the reason behind the exception.</div><div> </div><div>So DRL_1, this works perfectly fine.<br></div><div>
<font color="#9900ff" face="courier new,monospace">package drools;<br>import drools.ProposalLight;<br>import function drools.DateUtil.compareDatesWithTime;<br>rule "Date Rule"<br>when<br> $obj : ProposalLight(eval(compareDatesWithTime(endDateTime, -2, 6, \"<\")))</font></div>
<div><font color="#9900ff" face="courier new,monospace">then<br> $obj.addFailedRule("Date Rule");<br>end;</font></div><div> </div><div>DRL_2, this doesn't work. and throws [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star ....}] ...</div>
<div> </div><div><div><font color="#9900ff" face="courier new,monospace">package drools;<br>import drools.ProposalLight;<br>import function drools.DateUtil.compareDatesWithTime;<br>rule "Date Rule"<br>when<br> $obj : ProposalLight(<strong><font color="#0000ff">(</font></strong>eval(compareDatesWithTime(endDateTime, -2, 6, \"<\"))<strong><font color="#0000ff">)</font></strong>)</font></div>
<div><font color="#9900ff" face="courier new,monospace">then<br> $obj.addFailedRule("Date Rule");<br>end;</font></div></div><div> </div><div>Notice that extra paranthesis around eval(). This is where Drools 5.5 throws exception. Can someone please explain why this extra paranthesis throws exception and how can I make it work.</div>
<div> </div><div>Thanks,</div><div>Jeetendra.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 1:27 AM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The error message suggests that you have made a syntactic error in a<br>
rule which is not the one you have posted, or you have modified the<br>
rule too much to be of any help. Post again, taking great care not to<br>
omit anything or to change the cause of the problem. Also, indicate<br>
precisely the declaration of the function compareDatesWithTime().<br>
<span class="HOEnZb"><font color="#888888"><br>
-W<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 04/06/2013, jeetendray <<a href="mailto:jeetcyb@gmail.com">jeetcyb@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> Snippet of my DRL .<br>
><br>
> rule "Rev: Start Time < 2 Hours in Future"<br>
> when<br>
> $obj : eval(compareDatesWithTime(startDateTime, -2, 2, "<"))<br>
> then<br>
> $obj.addFailedRule("Rev: Start Time < 2 Hours in Future");<br>
> end<br>
><br>
> This fails during compilation and throws error:<br>
><br>
> org.drools.rule.InvalidRulePackage: Unable to Analyse Expression<br>
> (eval(compareDatesWithTime(startDateTime, -2, 2, "<")) ):<br>
> [Error: unable to resolve method using strict-mode: myObject.eval(boolean)]<br>
> [Near : {... (eval(compareDatesWithTime(star ....}]<br>
> ^<br>
> [Line: 6, Column: 2] : [Rule name='Proposal - Start time is after current +<br>
> 2 hour']<br>
><br>
><br>
> I am using Drools 5.5 and I found the cause that my code runs in strict<br>
> mode.. so If I set strict mode to false then this would work. Now I am not<br>
> sure how to make it to false.<br>
><br>
> Here's the code I am using:<br>
><br>
> PackageBuilderConfiguration packageBuilderConfiguration = new<br>
> PackageBuilderConfiguration();<br>
> PackageBuilder packageBuilder = new<br>
> PackageBuilder(packageBuilderConfiguration);<br>
> packageBuilder.addPackageFromDrl(drl.getCharacterStream());<br>
><br>
> Can someone please suggest me how to do that??<br>
><br>
> Thanks!!!<br>
><br>
><br>
><br>
> --<br>
> View this message in context:<br>
> <a href="http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-false-tp4024122.html" target="_blank">http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-false-tp4024122.html</a><br>
> Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
_______________________________________________<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>
</div></div></blockquote></div><br></div>