Forum > Database

TZQuery.OnCalcFields- Why it is executed twice?

(1/1)

SunyD:
I use TZQuery.OncalcFields, if I call TZQuery.Refresh then OncalcFields executed twice.
Do anyone know, why the is executed twice?

This is my code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.QuZCalcFields(DataSet: TDataSet);begin  //Saldo is Currency  // QuZSOLL and QuZHABEN are fields of this query  Saldo:=QuZSOLL.AsCurrency-QuZHABEN.AsCurrency+Saldo;   //Only QuZSALDO is CalcField  QuZSALDO.AsCurrency:=Saldo;  //ZBS ist autoinc  Memo1.Lines.Add(TimeToStr(now)+' - #BS: '+QuZ.FieldByName('ZBS').AsString+' - S: '+Format('%.2n', [saldo]));end; 
And here is log output after calling QuZ.Refresh;

18:01:08 - #BS: 1 - S: 50,00
18:01:08 - #BS: 2 - S: 550,00
18:01:08 - #BS: 3 - S: 550,00
18:01:08 - #BS: 4 - S: 610,00
18:01:08 - #BS: 5 - S: 640,00
18:01:08 - #BS: 1 - S: 690,00
18:01:08 - #BS: 2 - S: 1.190,00
18:01:08 - #BS: 3 - S: 1.190,00
18:01:08 - #BS: 4 - S: 1.250,00
18:01:08 - #BS: 5 - S: 1.280,00

Navigation

[0] Message Index

Go to full version