automatically calculated values


i’m trying to use Custom statistics counter (automatically calculated values). I use the following code:


var calck=function(){

var summ=0;

for (var i=0; i < mygrid.getRowsNum(); i++){

summ+= parseFloat(mygrid.cells(i,index).getValue());


return summ;



But my output ist NaN.

Do you know what’s wrong with my code?

Thanks in advance!

for (var i=0; i < mygrid.getRowsNum(); i++){
>>summ+= parseFloat(mygrid.cells(i,index).getValue());

The “i” is row index, but you are using its as parameter for cells command, which expects row ID as parameter
This will work if you have row IDs as numbers from 0 to N , but not safe in common case ( there is a cells2 command , which works exactly the same but accept row index as first parameter )

>>But my output ist NaN.
If you have at least one row with non-numeric value in calculated column - it will cause such result. You can change code as

for (var i=0; i < mygrid.getRowsNum(); i++){
var value=parseFloat(mygrid.cells(i,index).getValue());
if (!isNaN(value))
updated code will ignore any non-numeric cells