On 18 December 2010 18:25, AleBu <aleboo(a)gmail.com> wrote:
Hi,
[offtopic]
Thanks for quick response! It is always nice when project has an active and
friendly community. This is a sign of healthy project itself :)
[/offtopic]
My function was returning a collection.
If it returns a Collection<Tuple> you should be able to use
when
Something( $letters: collectionOfLetters )
Tuple( $letter: first, $count: second > 1 ) from createCardinality(
$letters )
then
System.out.println( "Letter "+letter+" is duplicated
"+$count+"
times" )
end
"from collect" generates a Collection<X> from individial X's; from
<Collection-expression> inspects elements coming from a collection.
Please note that better help can be obtained by showing all of the relevant
code and the error messages.
-W
It seems that I made an error in
import of the function. I had some debug, info, etc static methods in the
class and they were imported with import function ...* and it worked, so I
expected that adding public static createCountMap(...) into the same class
will solve it too, but somehow I needed to declare it explicitly.
Also, having the same code in Drools file in function declaration is not
working when I use java 5 syntax, so I just rewrote it with java 1.4 syntax
and it works fine too. If there is such a restriction, then it for sure
missed in official documentation
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/ht...
.
So, that were all my problems were :).
Thanks again for response!
I also can see another approach for solving the problem in the thread, so I
will play with it too - it looks interesting for me. Thinking in the
declarative drools like style requires some brain restructuring. It is like
moving from imperative to functional programming. And speaking of
functional
approach - It reminds me about Scala and question here is:
Can Scala be used as one of the dialects in the future? Are there any plans
or thinkings or wishes in the "wish-list" for it? :}
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-use-a-result-o...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users