Executing OnCalcFields without refreshing non-calced-fields
Posted: Sun 24 Jul 2011 09:21
Hi,
I try to recalc all fields of a TMSQuery without refreshing the data from the database server. The background is, that I have a field, that is dependet from the current time. Example:
DB-Field 1: TStart: TDateTime;
DB-Field 2: TStop: TDateTime;
Calc-Field: Duration: TDateTime;
In the OnCalc-Event the Duration will be calced as follows ():
Calling a Refresh of the query will update all fields but will allways execute also a complete refresh to the SQL-Server... My data is displayed in a TDBCtrlGrid. Therefore I need a dataaware component to display the field...
Any idea?
Alex
I try to recalc all fields of a TMSQuery without refreshing the data from the database server. The background is, that I have a field, that is dependet from the current time. Example:
DB-Field 1: TStart: TDateTime;
DB-Field 2: TStop: TDateTime;
Calc-Field: Duration: TDateTime;
In the OnCalc-Event the Duration will be calced as follows ():
Code: Select all
if not TStop.IsNull then
Duration.AsDateTime := TStop.AsDateTime - TStart.AsDateTime
else
Duration.AsDateTime := Now - TStart.AsDateTime;
Any idea?
Alex