<br> Sorry, it is not clear what you are trying to do. <br> There are a few clear mistakes in your rule:<br><br>1. You can't use the $totV variable inside the accumulate, since $totV is the "result" of the accumulate.
<br><br>2. You can't use variables bound inside accumulate outside of it, since accumulate is a scope delimiter ($ciNo, $ciLineNo).<br><br>3. If you want to sum values, use sum() function, but if you want to count occurrences, use the count() function.
<br><br>4. This expression is wrong: "$totV > 1". You must either compare something to a field or use an "eval()" (inlined or not) to evaluate arbitrary expressions.<br><br>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.
<br><br> Maybe if you can explain with more common terms what rule you are trying to write, we can help more... the best I could imagine is:<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
rule "00910 Pass XV sets"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> when</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
$status : ValidationPassFailStatus()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> exists ValidationControl(validationNo == 910)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> CiLines( $ciNo : $ciNo, $ciLineNo : $ciLineNo, spiSecondary == "X" )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Number( intValue > 1 )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> from accumulate( $c : CiLines( ciNo == $ciNo, ciLineNo == $ciLineNo, </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> spiSecondary == "V" ), </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
count( $c ) )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
$status.pass(910);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end</span><br style="font-family: courier new,monospace;"><br> Hope it helps.<br><br> Edson
<br><br><div><span class="gmail_quote">2007/7/27, Mike D <<a href="mailto:mike.dalaker@kewill.com">mike.dalaker@kewill.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Newbie question again...<br><br>I'm trying to get a count of V lines if I have an X. If more than 1 V line,<br>I pass... Obviously I can't have $totV on LHS, but you get my drift. What<br>is the correct syntax for this one? I've been digging in the docs on accum,
<br>but can't find anything that fits what I'm trying to do.<br><br>Thanks,<br>Mike<br><br>rule "00910 Pass XV sets"<br> when<br> $status : ValidationPassFailStatus()<br> exists ValidationControl(validationNo == 910)
<br> $totV : number()<br> from accumulate(CiLines($ciNo : $ciNo, $ciLineNo : ciLineNo, spiSecondary<br>== "V"), sum($totV))<br> CiLines(ciNo == $ciNo, ciLineNo == $ciLineNo, spiSecondary
<br>== "X", $totV > 1)<br> then<br> $status.pass(910);<br>end<br><br><br>--<br>View this message in context: <a href="http://www.nabble.com/Accum-question-tf4157809.html#a11829193">http://www.nabble.com/Accum-question-tf4157809.html#a11829193
</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli
<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>