Hi,
I am new to Drools and do some experiments on it, and encountered on a
problem which can't solve for a last few days, so maybe someone can explain
what I am doing wrong?
I will probably explain my problem with example. Lets say we have a
collection of letters like 'a', 'b', 'c', 'a',
'd', 'e', 'c'. And I want to
report all letters that are duplicated, but only once providing a number of
duplication. In other words, for each letter which is duplicated I need to
do a report by saying 'Letter X is duplicated N times.
My idea was to create cardinality collection for letters which is a
collection of POJOs Tuple where first is letter and second is cound (first
and second are properties). I created a function for it createCardinality(
Collection letters ) which returns such cardinality info and tried something
like:
when
Something( $letters: collectionOfLetters )
Tuple( $letter: first, $count: second > 1 ) from collect( Tuple() from
createCardinality( $letters ) )
then
System.out.println( "Letter "+letter+" is duplicated
"+$count+"
times" )
But I am reported (at least it looks like this) about the problems with my
function createCardinality(). Maybe I misunderstood something about usage of
FROM?
--
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.