<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Thanks Edson.&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>I don't why but when i am using the below&nbsp;rule in my drl it's failing to compile. </DIV>
<DIV>Not sure if i am doing something stupid or this is an issue with environment or the drl. </DIV>
<DIV>&nbsp;</DIV>
<DIV>I am attaching the drl file with the mail. The error that i get is : -</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>
<P align=left>testTestsRulesEngine(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>suitability.TestsRulesEngineTest)suitability.RulesEngineException</U></FONT></FONT><FONT size=2>: Could not load/compile rules file: testAccumulate.drl</P>
<P align=left>at suitability.RulesEngine.&lt;init&gt;(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>RulesEngine.java:39</U></FONT></FONT><FONT size=2>)</P>
<P align=left>at suitability.TestsRulesEngine.&lt;init&gt;(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>TestsRulesEngine.java:13</U></FONT></FONT><FONT size=2>)</P>
<P align=left>at suitability.TestsRulesEngineTest.setUp(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>TestsRulesEngineTest.java:72</U></FONT></FONT><FONT size=2>)</P>
<P align=left>Caused by: </FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>java.lang.NullPointerException</P></U></FONT></FONT><FONT size=2>
<P align=left>at org.drools.common.AbstractRuleBase.addPackages(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>AbstractRuleBase.java:434</U></FONT></FONT><FONT size=2>)</P>
<P align=left>at org.drools.reteoo.ReteooRuleBase.addPackage(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>ReteooRuleBase.java:388</U></FONT></FONT><FONT size=2>)</P>
<P align=left>at suitability.RulesEngine.&lt;init&gt;(</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>RulesEngine.java:36</U></FONT></FONT><FONT size=2>)</P>
<P align=left>... 14 more</P></FONT><BR>Regards,</DIV>
<DIV>Manav</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Edson Tirelli &lt;tirelli@post.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Manav &lt;manav7574@yahoo.com&gt;; Rules Users List &lt;rules-users@lists.jboss.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Mon, August 16, 2010 7:46:54 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [rules-users] Accumulate in Drools<BR></FONT><BR>
<DIV>&nbsp;&nbsp; &nbsp; You can't use the cast and the method call in a regular constraint. You can use it as part of an expression. So:</DIV>
<DIV><BR></DIV>
<DIV>&nbsp;$min_score : Number ()<BR>&nbsp;&nbsp;&nbsp;from accumulate (Client (productTypeExperience.keySet contains $name,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $score :&nbsp;productTypeExperience[$name],<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min (&nbsp;((ExperienceLevel)$score).value()&nbsp;) )</DIV>
<DIV><BR></DIV>
<DIV>&nbsp;&nbsp; &nbsp; We are working on the support of free form expressions on constraints for Drools 6 (not sure we can make it for 5.2).</DIV>
<DIV><BR></DIV>
<DIV>&nbsp;&nbsp; &nbsp; Edson</DIV><BR><BR>
<DIV class=gmail_quote>2010/8/15 Manav <SPAN dir=ltr>&lt;<A href="mailto:manav7574@yahoo.com" target=_blank rel=nofollow ymailto="mailto:manav7574@yahoo.com">manav7574@yahoo.com</A>&gt;</SPAN><BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<BR>I am trying my hand at the accumulate function in Drools 5.x but the drl fails<BR>to compile.<BR>Not sure what's wrong with it. Please help.<BR>This is the sample that i am working with<BR><BR>rule "Test Accumulate Function"<BR>when<BR>&nbsp;$p : ProductType ($name : name)<BR>&nbsp;$min_score : Number ()<BR>&nbsp;&nbsp;&nbsp;from accumulate (Client (productTypeExperience.keySet contains $name,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $score :<BR>((ExperienceLevel)productTypeExperience[$name]).value()),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min ($score))<BR>then<BR>&nbsp;System.out.println ("$min_score" + $min_score);<BR>end<BR>Regards,<BR><FONT color=#888888>Manav<BR></FONT>
<DIV>
<DIV></DIV>
<DIV class=h5><BR><BR><BR><BR>_______________________________________________<BR>rules-users mailing list<BR><A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="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 rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR clear=all><BR>-- <BR>&nbsp; Edson Tirelli<BR>&nbsp; JBoss Drools Core Development<BR>&nbsp; JBoss by Red Hat @ <A href="http://www.jboss.com/" target=_blank rel=nofollow>www.jboss.com</A><BR></DIV></DIV></div><br>







      </body></html>