Move all of the Java conversion into the average() call - you cannot bind a
variable to an arbitrary expression.

Also, I strongly suggest to stick with Float during the accumulation and
postpone rounding until you have the exact average result value.

-W

On 16 January 2012 07:24, bobbi_80 <guruprasad_bobbi@infosys.com> wrote:
Hi,

I have the following bean and trying to run "accumulate" to get the average
of CPU usage from a cluster.

      public static class cpuTracker{

              private String machinename;
              private String averageCPU;
      }

My rule is as follows.

rule check
       when
               $aggr : Number() from accumulate(cpuTracker($avg :
Integer.parseInt(averageCPU.split("\\.")[0])), average($avg))
       then
               System.out.println(" Average value : " + $aggr);
end

If the averageCPU is an integer type then accumulate works fine but my
problem is that it is string type and I am trying to convert it to integer
from a rule file and it throws a bunch of compile time errors.

any help in resolving it or some workaround is highly appreciated.




--
View this message in context: http://drools.46999.n3.nabble.com/using-CE-accumulate-tp3662339p3662339.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users