Subject Attn Helen Borrie: Re: [IBO] Calculated fields
Author stewartbourke@eircom.net
I was wondering if you (or anybody) had any comments on this issue?

THanks,

Stewart Bourke


--- In IBObjects@y..., stewartbourke@e... wrote:
> Helen,
>
> Thanks for that.
>
> I can understand why the fields should be read-ony. In fact I do
not
> want the users to be able to edit them. I simply want to assign
them
> a value in the oncalc event which is displayed to the user.
>
> I am a bit confused however by this paragraph:
>
> > A calculated field ONLY exists as the result of a calculation -
you
> cannot assign a value to it. Calculated fields (whether
originating
> from the database via COMPUTED BY or calculated in client code) are
> always read-only.
>
> I have been using a TIBoTable. I don't appear to have a problem
> with queries - they allow me process the oncalc field fine. It is
> only when I use calc fields in the tibotable.
>
> I did the following:
>
> 1. Placed a tibotable on the form and assigned it to a table
> 2. Double clicked the table to bring up the fields editor
> 3. In the FE, I added all fields, then a new field , type
calculated
> and called it tbLeadHdrLdh_name_details, type string, 30 chars
> and in my oncalc event:
>
> tbLeadHdrLdh_Name_Details.AsString:='Details: '+
>
> tbLeadHdrLdh_FirstName.AsString+', '+tbLeadHdrLdh_SurName.AsString
>
> This causes the exception 'dataase not in edit mode'
>
> Any help would be appreciated,
>
> Thanks & Regards,
>
> Stewart Bourke.
>
>
>
>
>
>
>
>
> --- In IBObjects@y..., Helen Borrie <helebor@w...> wrote:
> > At 03:10 AM 04-03-01 +0000, you wrote:
> > >This is probably not only an IBO situation but I have a question
> > >regarding calculated fields on an IBOTable.
> > >
> > >I have defined a calculated field which is evaluated in the
> > >oncalcfields event. My problem is that I am getting an
> > >error 'dataase not in edit mode' every time I assign the
> calculated
> > >field a value in the oncalcfield event, when the table's state
is
> > >dsBrowse.
> >
> > A calculated field ONLY exists as the result of a calculation -
you
> cannot assign a value to it. Calculated fields (whether
originating
> from the database via COMPUTED BY or calculated in client code) are
> always read-only.
> >
> > To solve the problem of the real data columns being not editable,
> if you are using TIBOQuery, instantiate the field object of the
calc.
> field and set its FieldKind to fkCalculated. If you are using
> TIB_Query, double-click on the query object to open the Fields
Editor
> and set the field's COMPUTED attribute true.
> >
> > hth
> >
> > Helen
> >
> >
> > >I can understand the logic (I Think!) behind this from the
> > >point of view that I am assigining a value to a field from the
> > >dataseset, which it then attempts to write to the database, My
> > >question is how do I stop it.
> > >
> > >Is there a way to have the oncalcfield event fire and to be able
> to
> > >assign the calculated field value without the table objecting.
> > >Similar calculated fields work fine in an IBOQuery - but the
> again
> > >the result set will not be live.
> > >
> > >Thanks,
> > >Stewart Bourke
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> >
> > All for Open and Open for All
> > InterBase Developer Initiative ยท http://www.interbase2000.org
> > _______________________________________________________