Move all of the Java conversion into the average() call - you cannot bind a<br>variable to an arbitrary expression.<br><br>Also, I strongly suggest to stick with Float during the accumulation and<br>postpone rounding until you have the exact average result value.<br>
<br>-W<br><br><div class="gmail_quote">On 16 January 2012 07:24, bobbi_80 <span dir="ltr"><<a href="mailto:guruprasad_bobbi@infosys.com">guruprasad_bobbi@infosys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I have the following bean and trying to run "accumulate" to get the average<br>
of CPU usage from a cluster.<br>
<br>
public static class cpuTracker{<br>
<br>
private String machinename;<br>
private String averageCPU;<br>
}<br>
<br>
My rule is as follows.<br>
<br>
rule check<br>
when<br>
$aggr : Number() from accumulate(cpuTracker($avg :<br>
Integer.parseInt(averageCPU.split("\\.")[0])), average($avg))<br>
then<br>
System.out.println(" Average value : " + $aggr);<br>
end<br>
<br>
If the averageCPU is an integer type then accumulate works fine but my<br>
problem is that it is string type and I am trying to convert it to integer<br>
from a rule file and it throws a bunch of compile time errors.<br>
<br>
any help in resolving it or some workaround is highly appreciated.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/using-CE-accumulate-tp3662339p3662339.html" target="_blank">http://drools.46999.n3.nabble.com/using-CE-accumulate-tp3662339p3662339.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></span></blockquote></div><br>