Subject Re: [IBO] IB_Grid with Calculated Fields
Author Lucas Franzen
alvin@... schrieb:
>
> Any sample code on how to show a calculated fields in IB_Grid???

TIB_Query:
SELECT CUST_NAME, CUST_NO, CUST_TYPE from CUSTOMER

Calculated Field:
CUST_RANKING=VARCHAR(20)

Add a OnCalculate event for the Query:

procedure TForm1.qryCustCalculateField ( ... )
begin
if aField.FieldName = 'CUST_RANKING' then
begin
case aRow.ByName ( 'CUST_TYPE' ).AsInteger of
1 : aField.AsString := 'NORMAL CUSTOMER';
2 : aField.AsString := 'GOOD CUSTOMER';
3 : aField.AsString := 'VERY GOOD CUSTOMER';
4 : aField.AsString := 'PHANTASTIC CUSTOMER';
end;
end;
end;

just catch the Calculate Field by comparing aField.FieldName.
You can access the current values of the record by: aRow.ByName
(FIELDNAME)

Luc.