Hi,
While exporting a report to excel, the following code is used in the OnPreDataItem() of the “Sales Invoice Header” table.
window.OPEN(Text001 + ‘@1@@@@@@@@@@@@@@@@@@@@@’);
window.UPDATE(1,0);
TotalRecNo := “Sales Invoice Header”.COUNTAPPROX;
RecNo :=0;
TempExcelBuffer.DELETEALL;
CLEAR(TempExcelBuffer);
ENTERCELL(1, 1, Text000, TRUE, TRUE, FALSE);
ENTERCELL(1, 2, Text002, TRUE, TRUE, FALSE);
ENTERCELL(1, 3, Text003, TRUE, TRUE, FALSE);
ENTERCELL(1, 4, Text004, TRUE, TRUE, FALSE);
ENTERCELL(1, 5, Text005, TRUE, TRUE, FALSE);
ENTERCELL(1, 6, Text006, TRUE, TRUE, FALSE);
row := 1;
RecNo := RecNo + 1;
window.UPDATE(1,ROUND(RecNo / TotalRecNo * 10000,1));
END;
Can anyone tell me what the “COUNTAPPROX” function do? What value does the ‘TotalRecNo’ variable field fetch the value. Coz its giving me a ‘Division By Zero’ of which the error points to the window.UPDATE line in the code.Its showing the ‘TotalRecNo’ value as 0 in the debugger.
Thanks in advance…