Subject Re: [IBO] Calculated fields problem..
Author Woody (TMW)
> >Helen wrote:
> >
> >Still does the same thing. The grid shows empty names just after opening
> >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
> RefreshBuffers.

Even though it's row level only, shouldn't it do the calculation at least
the first time the query is opened when showing records in a grid?

> >If I "walk" the records calling
> >CalculateFields each time, the names are all there. I don't want to do
> >everytime I open and close the query, though. There must be something
> >happening.
> Why would you want to be recalculating it for every row each time you
> change one row? I don't get that...

No, no, no. I only walk the records when the query is closed and reopened,
not every time one field changes. When changing the sort order of the grid
listing, the query must be closed, ORDER BY clause modified, and the query
reopened. If I don't walk through the records, the FULLNAME calculation is
not done and it shows blanks. That's the only time I actually iterate
through them. Any other time, I simply call CalculateFields on the current

> 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.

Not to worry. As I said, I've circumvented the problem for now. The table
will never have more than 10 or so records so the time it takes to do this
is not relevant. I just think it strange that the calculation isn't done
initially for all records showing in a TIB_Grid.

Woody (TMW)