Row By Row Running Total
Hi,
I am trying to get a row by row running total and would like advice on how..
I have tried to following,
Which returns the following,
Please Help,
Jez
I am trying to get a row by row running total and would like advice on how..
I have tried to following,
// Set Grid Headers, Cells and Formats
var obj = new AW.UI.Grid;
var myHeaders = ["Invoice Balance","Running Total"];
var myCells = [["10.00"],["20.00"],["30.00"],["40.00"]];
var num = new AW.Formats.Number;
num.setTextFormat('#,###.##');
obj.setCellFormat([num, num, num]);
// Running Total Function
function balance1(col, row)
{
var cell2 = obj.getCellValue(0, row);
var cell1 = obj.getCellValue(0, row-1);
var total = cell1 + cell2;
return total;
}
// Set Column Indices and Running Total Function into Column 1
obj.setColumnIndices([0, 1, 2]);
obj.setCellData(balance1,1);
// Set grid text
obj.setHeaderText(myHeaders);
obj.setCellText(myCells);
// set number of columns/rows
obj.setRowCount(myCells.length);
// write grid to the page
document.write(obj);
Which returns the following,
Invoice Balance, Running Total,
10.00 10.00
20.00 30.00
30.00 50.00
40.00 70.00
Please Help,
Jez
Jez
September 12,