Subject Re: [IBO] TIB_Cursor
Author Lucas Franzen
Michael,

Michael Vilhelmsen schrieb:

> Hi
>
> I'm about to change some TIBOQuery to TIB_Cursor.
> On some of my TIBOQuery comp. I have some calculated fields.
>
> Can I do this on a TIB_Cursor as well ?
>
> And maybe how to ?

yes, the properties are there, too.

Howto?
Add your calculated field, like:
MYCALC_FIELD=VARCHAR(30)
and write an event handler for OnCalculateField like:

if aField.Fieldname = 'MYCALC_FIELD' then
begin
case aRow.ByName ( 'MYOTHER_FIELD' ).AsInteger of
0 : myField.AsString := 'Zero';
1 : myField.AsString := 'One';
2 : myField.AsString := 'Two';
3 : myField.AsString := 'Three';
else myField.AsString := 'Counting ability exceeded';
end;
end;

BUT:
Keep in mind that cursors are usually not used when displaying contents
(since they're unidirectional) and you do move through the records
invisibly - so I'm not sure if it makes too much sense using calculated
fields then - since you could do your calculations just in the code
where you step through the records...

(ie. changing a TIBOQuery to a TIB_Cursor is changing two things in one)


Luc.