Thanks Edson. Yea, I typed it on the fly instead of cut/paste. I will try
the inline eval.
Your help is appreciated!
Edson Tirelli-3 wrote:
Sorry, it is not clear what you are trying to do.
There are a few clear mistakes in your rule:
1. You can't use the $totV variable inside the accumulate, since $totV is
the "result" of the accumulate.
2. You can't use variables bound inside accumulate outside of it, since
accumulate is a scope delimiter ($ciNo, $ciLineNo).
3. If you want to sum values, use sum() function, but if you want to count
occurrences, use the count() function.
4. This expression is wrong: "$totV > 1". You must either compare
to a field or use an "eval()" (inlined or not) to evaluate arbitrary
5. I think it is simply a typo, but since the DRL is case sensitive, the
java class Number must be written with capital N.
Maybe if you can explain with more common terms what rule you are
to write, we can help more... the best I could imagine is:
rule "00910 Pass XV sets"
$status : ValidationPassFailStatus()
exists ValidationControl(validationNo == 910)
CiLines( $ciNo : $ciNo, $ciLineNo : $ciLineNo, spiSecondary == "X" )
Number( intValue > 1 )
from accumulate( $c : CiLines( ciNo == $ciNo, ciLineNo ==
spiSecondary == "V" ),
count( $c ) )
Hope it helps.
2007/7/27, Mike D <mike.dalaker(a)kewill.com>:
> Newbie question again...
> I'm trying to get a count of V lines if I have an X. If more than 1 V
> I pass... Obviously I can't have $totV on LHS, but you get my
> drift. What
> is the correct syntax for this one? I've been digging in the docs on
> but can't find anything that fits what I'm trying to do.
> rule "00910 Pass XV sets"
> $status : ValidationPassFailStatus()
> exists ValidationControl(validationNo == 910)
> $totV : number()
> from accumulate(CiLines($ciNo : $ciNo, $ciLineNo :
> ciLineNo, spiSecondary
> == "V"), sum($totV))
> CiLines(ciNo == $ciNo, ciLineNo == $ciLineNo,
> == "X", $totV > 1)
> View this message in context:
> Sent from the drools - user mailing list archive at Nabble.com
> rules-users mailing list
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
rules-users mailing list