Calc Columns - Suppress Zeros
Using the calculated columns patch I am calculating a nett total figure across a row within a grid.
This works fine, my problem is when I scroll up and down the grid my function kicks in and returns zero's.. Can I suppress them in any way or can my code be made more efficient??
Here's the code
Also is the calculated columns patch now put of the library?? if so I can reduce some of my code...
This works fine, my problem is when I scroll up and down the grid my function kicks in and returns zero's.. Can I suppress them in any way or can my code be made more efficient??
Here's the code
//Calcuation for line totals
obj.onCellValueChanged = function(value, col, row){
if(col==1 || col==2 || col==3){
var t=type.getControlText();
if (t=='SI')
{obj.setCellFormula('(((column(1)/100)*column(3)-column(1))*column(2))*-1', 4);} // calc line total in column-4
else {obj.setCellFormula('(((column(1)/100)*column(3)-column(1))*column(2))', 4);} // calc line total in column-4
obj.setCellData(NettTotal,6, 50);
obj.setCellData(VatTotal,6, 51);
obj.setCellData(Total,6, 52);
obj.setCellText(VAT.getControlText(),6,row);
obj.setCellText(cent.getControlText(),5,row);
var nettrefresh = obj.getCellText(6, 50);
var vatrefresh = obj.getCellText(6, 51);
var totalrefresh = obj.getCellText(6, 52);
var discrefresh = obj.getCellText(6, 53);
nett.setControlText(nettrefresh);
vat.setControlText(vatrefresh);
total.setControlText(totalrefresh);
disc.setControlText(discrefresh);
nett.refresh();
vat.refresh();
total.refresh();
disc.refresh();
}
}
Also is the calculated columns patch now put of the library?? if so I can reduce some of my code...
Jez
December 8,