Creating Calculated fields at run-time?



I have followed the likes of TI2790 "Creating and deleting TFields at
Run-time", but have had no success in adding calculated fields to a
TIBQuery. If I iterate through the FieldList after having added the
fields, I see the fields I want, but a call to
Query.FieldByName('Field').Asxxx generates an error saying the field
could not be found. I have tried variations of:

TempQuery.Active:=False;
TempQuery.FieldDefs.Clear;
FValue:=TStringField.Create(Self);
FValue.FieldName:='Value';
FValue.Calculated:=True;
FValue.DataSet:=TempQuery;
FValue.Name:='cfValue';
FValue.Index:=0;
TempQuery.FieldDefs.Update;

I have tried not clearing FieldDefs and adding the new defs at the end
of the list, but this seems to create an empty value at the first
position of FieldDefs.

Can someone give me a clear idae of what I should be doing?

Any help will be appreciated.
.