On 1 June 2011 16:55, Simon Chen <simonchennj@gmail.com> wrote:
Hi all,
I have the following problem.
Let's say, I have a class Number3(), with three fields a, b, and c.
I have the following rule:
rule "test3"
when
Number3($a: a, $b: b)
$minvalue: Number()
from accumulate(Number3(a == $a, b == $b, $c: c), min($c))
then
System.out.println($a + " " + $b + " " + $minvalue);
end
Say, I have four objects (1,2,3), (1,2,4), (1,3,4), (1,3,5).
The result shows four lines:
1 3 4.0
1 3 4.0
1 2 3.0
1 2 3.0
But I want the output to be:
1 3 4.0
1 2 3.0
meaning that for each unique pair of a and b, I want the rule to fire only once.
Is this doable?
Thanks.
-Simon
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users