Sorry, my code is ugly in last email...
This is more clean:
rule "The Rule"
no-loop true
when
questionarioResposta : QuestionarioResposta()
$resultFinal : Number() from
accumulate(QuestaoResposta($peso:questao.questaoPeso.peso)
from
questionarioResposta.getQuestoesResposta(),
sum( $peso ))
then
System.out.println($resultFinal);
update( questionarioResposta );
end
This is a recursive and no-loop is ignored.
Who knows why this?
Thanks
Alessandro Lazarotti escreveu:
> Hi
> When I use accumulate and update, no-loop is ignored and the rule is
> recursive.
> Why?
>
> The Rule:
>
> rule "Nota final das questoes"
> no-loop true
> when
>
> questionarioResposta : QuestionarioResposta()
> $result : Number() from
> accumulate(QuestaoResposta($nota:nota,$peso:questao.questaoPeso.peso)
> from
> questionarioResposta.getQuestoesResposta(),
> sum($nota * (Double)$peso))
> $resultFinal :
> Number() from
> accumulate(QuestaoResposta($nota:nota,$peso:questao.questaoPeso.peso)
> from
> questionarioResposta.getQuestoesResposta(),
> sum( $peso ))
> then
> System.out.println($result.doubleValue() /
> $resultFinal.doubleValue());
> questionarioResposta.setNotaFinal($result.doubleValue() /
> $resultFinal.doubleValue());
> update( questionarioResposta );
> end
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users