<br> Please, share with us! Send to the list!<br><br> Edson<br><br><div><span class="gmail_quote">2007/8/21, pentarious <<a href="mailto:cristiano.giuffrida@gmail.com">cristiano.giuffrida@gmail.com</a>>:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>I found an interesting implementation to do that. If anyone is interested I<br>could share my solution.
<br><br>Regards,<br><br>CG<br><br><br>Mark Proctor wrote:<br>><br>> There is no supported way to do this. You could use an inline-eval<br>> against a global, but that is very clunkey. However it does seem like a<br>
> good feature idea for a future release, open a jira and I'll look into<br>> getting it included.<br>><br>> Mark<br>> pentarious wrote:<br>>> Does anyone know a method to limit the number of results from a collect
<br>>> statement? I was just wondering how to do something like this:<br>>> $myList : List() from collect( MyObject(myField == "something") ) limit 3<br>>> //it should put in $myList just the first 3 objects retrieved
<br>>> I'm quite sure there is nothing in Drools which can natively support<br>>> something like that. So, how to do that, if needed? I tried this, but it<br>>> seems not to be working (I can't understand why, though):
<br>>> $myList : List() from collect( MyObject(myField == "something") )<br>>> $myObject : MyObject() from $myList<br>>> eval( $myList.indexOf($myObject) < 3 )<br>>> Indeed, it doesn't work because the link beetween $myList and $myObject
<br>>> seems to be released during any execution of the rule (In fact<br>>> $myList.contains($myObject) returns false! Again, I can't understand<br>>> why...)<br>>><br>>> Any advice would be really appreciated!
<br>>><br>>> Regards,<br>>><br>>> CG<br>>><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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>><br>><br><br>--<br>View this message in context: <a href="http://www.nabble.com/How-to-limit-results-from-a-collect-statement-tf4235669.html#a12249025">
http://www.nabble.com/How-to-limit-results-from-a-collect-statement-tf4235669.html#a12249025</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</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">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @
<a href="http://www.jboss.com">www.jboss.com</a>