<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> </DIV>
<DIV>Am using 2.0.10 (mvel2-2.0.10.jar) . That's giving the issue below.</DIV>
<DIV> </DIV>
<DIV>Also tried it with other versions mvel2-2.0.16.jar , mvel2-2.0.17.jar but no luck.</DIV>
<DIV> </DIV>
<DIV>regards,</DIV>
<DIV>Manav</DIV>
<DIV><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Edson Tirelli <tirelli@post.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Manav <manav7574@yahoo.com>; Rules Users List <rules-users@lists.jboss.org><BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [rules-users] Accumulate in Drools</FONT><BR></DIV>
<DIV>> Which version of MVEL are you using?<BR>><BR>> Edson<BR>><BR>>2010/8/17 Manav <manav7574 at yahoo.com><BR>><BR>> Here's the modified rule :<BR>><BR>> rule "Test Accumulate Function"<BR>> when<BR>> $p : ProductType ($name : name)<BR>> $min_score : Number ()<BR>> from accumulate (Client (productTypeExperience.keySet contains $name,<BR>> $score : productTypeExperience[$name]),<BR>> min (((ExperienceLevel)$score).value()))<BR>><BR>> then<BR>> System.out.println ("$min_score" + $min_score);<BR>> end<BR>><BR>> and the runtime exception that i am getting is<BR>> Caused
by: org.drools.RuntimeDroolsException:<BR>> [Error: unable to resolve method: java.util.HashMap.$name() [arglength=0]]<BR>> [Near : {... Unknown ....}]<BR>><BR>> Regards,<BR>> Manav<BR>><BR></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 <tirelli@post.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Manav <manav7574@yahoo.com>; Rules Users List <rules-users@lists.jboss.org><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> 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> $min_score : Number ()<BR> from accumulate (Client (productTypeExperience.keySet contains $name,<BR> $score : productTypeExperience[$name],<BR> min ( ((ExperienceLevel)$score).value() ) )</DIV>
<DIV><BR></DIV>
<DIV> 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> Edson</DIV><BR><BR>
<DIV class=gmail_quote>2010/8/15 Manav <SPAN dir=ltr><<A href="mailto:manav7574@yahoo.com" target=_blank rel=nofollow ymailto="mailto:manav7574@yahoo.com">manav7574@yahoo.com</A>></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> $p : ProductType ($name : name)<BR> $min_score : Number ()<BR> from accumulate (Client (productTypeExperience.keySet contains $name,<BR> $score :<BR>((ExperienceLevel)productTypeExperience[$name]).value()),<BR> min ($score))<BR>then<BR> 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> Edson Tirelli<BR> JBoss Drools Core Development<BR> 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>