Recent

Author Topic: TZQuery.OnCalcFields- Why it is executed twice?  (Read 3274 times)

SunyD

  • Guest
TZQuery.OnCalcFields- Why it is executed twice?
« on: March 22, 2017, 06:03:10 pm »
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  [Select][+][-]
  1. procedure TForm1.QuZCalcFields(DataSet: TDataSet);
  2. begin
  3.   //Saldo is Currency
  4.   // QuZSOLL and QuZHABEN are fields of this query
  5.   Saldo:=QuZSOLL.AsCurrency-QuZHABEN.AsCurrency+Saldo;
  6.  
  7.   //Only QuZSALDO is CalcField
  8.   QuZSALDO.AsCurrency:=Saldo;
  9.  
  10.  //ZBS ist autoinc
  11.   Memo1.Lines.Add(TimeToStr(now)+' - #BS: '+QuZ.FieldByName('ZBS').AsString+' - S: '+Format('%.2n', [saldo]));
  12. end;
  13.  

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


 

TinyPortal © 2005-2018