Subject | RE: [IBO] What's the best way to calculate a field in TIB_Grid? |
---|---|
Author | Claudio Valderrama C. |
Post date | 2000-12-08T07:57:49Z |
A friend mine wrote specific code to detect when a field loses focus, so the
code was tied to the GUI. He had to make sure no field involved was NULL,
empty, etc., and called CalculateFields that makes possible to force the
event for calculated fields to trigger immediately.
C.
code was tied to the GUI. He had to make sure no field involved was NULL,
empty, etc., and called CalculateFields that makes possible to force the
event for calculated fields to trigger immediately.
C.
> -----Original Message-----
> From: Jörg Schiemann [mailto:schimmi@...]
> Sent: Sábado 2 de Diciembre de 2000 15:16
>
> 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