On 18 December 2010 18:25, AleBu <span dir="ltr">&lt;<a href="mailto:aleboo@gmail.com">aleboo@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi,<br>
[offtopic]<br>
Thanks for quick response! It is always nice when project has an active and<br>
friendly community. This is a sign of healthy project itself :)<br>
[/offtopic]<br>
My function was returning a collection.</blockquote><div><br>If it returns a Collection&lt;Tuple&gt; you should be able to use<br><br>when<br>
        Something( $letters: collectionOfLetters )<br>
        Tuple( $letter: first, $count: second &gt; 1 ) from createCardinality( $letters )<br>
then<br>
        System.out.println( &quot;Letter &quot;+letter+&quot; is duplicated &quot;+$count+&quot; times&quot; )<br>
end<br><br>&quot;from collect&quot; generates a Collection&lt;X&gt; from individial X&#39;s; from &lt;Collection-expression&gt; inspects elements coming from a collection. <br><br>Please note that better help can be obtained by showing all of the relevant code and the error messages.<br>
-W<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> It seems that I made an error in<br>
import of the function. I had some debug, info, etc static methods in the<br>
class and they were imported with import function ...* and it worked, so I<br>
expected that adding public static createCountMap(...) into the same class<br>
will solve it too, but somehow I needed to declare it explicitly.<br>
Also, having the same code in Drools file in function declaration is not<br>
working when I use java 5 syntax, so I just rewrote it with java 1.4 syntax<br>
and it works fine too. If there is such a restriction, then it for sure<br>
missed in official documentation<br>
<a href="http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch04.html#d0e3200" target="_blank">http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch04.html#d0e3200</a>.<br>

So, that were all my problems were :).<br>
Thanks again for response!<br>
I also can see another approach for solving the problem in the thread, so I<br>
will play with it too - it looks interesting for me. Thinking in the<br>
declarative drools like style requires some brain restructuring. It is like<br>
moving from imperative to functional programming. And speaking of functional<br>
approach - It reminds me about Scala and question here is:<br>
Can Scala be used as one of the dialects in the future? Are there any plans<br>
or thinkings or wishes in the &quot;wish-list&quot; for it? :}<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/How-to-use-a-result-of-custom-defined-function-in-WHEN-part-tp2110515p2111854.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/How-to-use-a-result-of-custom-defined-function-in-WHEN-part-tp2110515p2111854.html</a><br>

</font><div><div></div><div class="h5">Sent from the Drools - User 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>
</div></div></blockquote></div><br>