Subject Re: [IBO] How to edit calculated field?
Author mmenaz
Sometimes I've found it would be very usefull may define a "local
working column" where the user can enter data. I.e. having, for a
limited amount of data, of course, the possibility to add a "choose
field", boolean, so the user can flag it into the displayed grid and I
can read it back traversing the dataset local buffer... What do you
think about that? Are you using easy solution if you want to display
some data an have the user to flag/set some value?
Marco Menardi

--- In IBObjects@y..., "Helen Borrie (TeamIBO)" <helebor@d...> wrote:
> At 09:12 AM 28-01-02 +0000, you wrote:
> >(Hope this hasn't been asked before - the search options provided by
> >yahoo are not very good).
> >
> >I would like to edit a calculated field in a TIB_Grid control.
> >
> >The background is: a table stores a person's age in days (thus its an
> >integer field). This is however not very convenient for display, so I
> >created three calculated fields to return the person's age in days,
> >months, years (calculating with 1y=365d, 1m=30d).
> >This works fine.
> >
> >Now I would like to be able to edit those three fields and then
> >calculate back to the age in days and store this in the db.
> >
> >Anyone can give me a hint
> >(a) how to get the calculated fields editable
> >(b) on which event to react to update person.age with the entered
> >value(s)?
> You can't edit calculated fields at all. They can only be changed
by modifying the data upon which they are calculated and then calling
CalculateFields. What you propose is the "reverse" of this.
> You could somehow mirror the contents of the calculated fields into
ordinary TEdits, read and validate those in some event handler and use
their data to calculate new values for the underlying columns.
> regards,
> Helen Borrie (TeamIBO Support)
> ** Please don't email your support questions privately **
> Ask on the list and everyone benefits
> Don't forget the IB Objects online FAQ - link from any page at