Closed AJNorman closed 11 years ago
I found a solution:
In pivot.js, add in this function;
cumtotal = 0;
function defaultSummarizeFunctionCumSum(rows, field) {
var runningTotal = 0,
i = -1,
m = rows.length;
while (++i < m) {
runningTotal += rows[i][field.dataSource];
};
cumtotal += runningTotal;
return cumtotal;
};
in main code when initialising variables:
{ name: 'cumnet', type: 'float', rowLabelable: false, pseudo: true, dataSource: 'net', summarizable: 'cumsum', displayFunction: function (value) { return accounting.formatMoney(value) } }
also need to amend pivot.js;
function processSummaryResults() { var i = 0; for (var resultKey in results) { if (i == 0) { cumtotal = 0; } getSummaryResults(results[resultKey]) i++; };
return results;
};
Hi,
Has anyone attempted to create a function or code to view the results as cumulative?
In excel, it is still the sum of the field but shows values as running total based on the base fields.
Cheers,
AJ