Subject Re: [IBO] Calculated fields problem..
Author Helen Borrie
At 10:48 PM 20/10/2004 -0500, you wrote:

>Helen wrote:
> >
> > Yes, it is a simple thing. CalculateFields operates on a row, so pick up
> > the ARow argument and operate on that. OnCalculateField gets called once
> > for each field in the CalcFields array, so AField gives you a reference to
> > the calculated field.
> > I hope you'll forgive me for pushing the guts of this out into a separate
> > function. I get anxiety symptoms when I find myself writing event
> > with lots of lines in them. :-)
>I've gotten to where I try to do the same thing myself. :)
> >
> > procedure TfrmWorkers.WorkersCalculateField(Sender: TIB_Statement;
> > ARow: TIB_Row; AField: TIB_Column);
> > begin
> > // test not appropriate if Assigned(AField) then
> > if AField.Name = 'FULLNAME' then
>AField.Fieldname, there is no NAME property for TIB_Column.

Yup, correct.

> >
> > Also, call CalculateFields whenever you need the calculation done. IBO
> > should do it automatically on Open and Refresh (check, though). However,
> > because a calculated field isn't a dataset object, you can make it do its
> > stuff at other times as well.
>Still does the same thing. The grid shows empty names just after opening the
>query. If I call CalculateFields just after opening the query, the first
>name shows up but the rest don't.

That's correct. CalculateFields operates at row level. I checked the
source and it's definitely being called in AfterFetchRow; and also in

>If I "walk" the records calling
>CalculateFields each time, the names are all there. I don't want to do that
>everytime I open and close the query, though. There must be something else

Why would you want to be recalculating it for every row each time you
change one row? I don't get that...

I'll do a bit of a demo and post it to the Files area of the list. It
won't be fancy as I'm flat-out right now on the releasenotes for Fb 1.5.2.