Subject Re: [IBO] Problem with IB_Query Calculated Fields
Author Jason Wharton
You need to use the ARow.ByName() instead of the FieldByName() method to get
at the columns that are being read from and written to.

HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Francis Moore" <moorefg@...>
To: <IBObjects@egroups.com>
Sent: Sunday, November 12, 2000 9:55 AM
Subject: [IBO] Problem with IB_Query Calculated Fields


> I have a problem with IB_Query and calculated fields in that IB_Query
> is not returning calculated fields - it delivers just row when the
> row is selected and row twitches indicating that the row is being
> constantly updated.
>
> I have set up an IBOQuery in parallel and this works as expected.
>
> I enclose onCalc code for IB_Q and IBO.
>
> procedure TSchemesForm1.IB_Query6CalculateField(Sender: TIB_Statement;
> ARow: TIB_Row; AField: TIB_Column);
> var
> intbal : Double;
> begin
> intbal:= intbal + IB_Query6.FieldByName('amount').AsFloat;
> IB_Query6.FieldByName('Balance').AsFloat:= intbal;
> IB_Query6.FieldByName('abc').AsString := IB_Query6.FieldByName
> ('descript').Value;
> end;
>
> procedure TSchemesForm1.IBOQuery1CalcFields(DataSet: TDataSet);
> var
> intbal : Double;
> begin
> intbal:= intbal + IBOQuery1.FieldByName('amount').AsFloat;
> IBOQuery1.FieldByName('Balance').AsFloat:= intbal;
> IBOQuery1.FieldByName('abc').AsString := IBOQuery1.FieldByName
> ('descript').Value;
> end;
>
> [I appreciate that intbal is declared locally and therefore the
> balance will not increment - this was just the first step].
>
> For IB_Query both ABC and Balance are set up as computed fields.
>
> What am I doing wrong with IB_Query?
>
> Looking forward to your assistance.
>
> Kind regards,
>
> Francis Moore
>
>
>
>
>