Subject What's the best way to calculate a field in TIB_Grid?
Author Jörg Schiemann
Hi,

what's the best way to calculate a field in TIB_Grid?

I tested with

CREATE TABLE t_test
(
QUANTITY INTEGER;
HOURLY_WAGGE NUMERIC(18,2);
COST COMPUTED BY (QUANTITY * HOURLY_WAGGE)
);

but it doesn't update the field in the grid.

I also tested another way with CalculateFields in TIB_Query

procedure TfrmJob.qryJobCalculateField(
Sender: TIB_Statement; ARow: TIB_Row; AField: TIB_Column);
begin
with AField do
if FieldName = 'COST' then
AsDouble := ARow.ByName('QUANTITY').AsInteger +
ARow.ByName('HOURLY_WAGGE').AsDouble;
end;

that way the field gets updated, but first when you post the changes.

I'm looking for a function which updates the field directly when the field
QUANTITY or HOURLY_WAGGE lost the focus.

TIA

Jörg Schiemann