Subject | Re: Attn Helen Borrie: Re: [IBO] Calculated fields |
---|---|
Author | Helen Borrie |
Post date | 2001-03-14T01:24:11Z |
At 12:47 AM 14-03-01 +0000, you wrote:
If you were using TIBOQuery, you could bring the calculated column across to your app and disregard OnCalcFields, e.g.
SELECT *,
'Details : ' ||Ldh_Name_FirstName||' '|| Ldh_Name_Surname AS
Ldh_Name_Details
from LeadHdr
WHERE <restricting clause>
In your dataset you would then have a read-only column named Ldh_Name_Details. Does this help you to understand what I was referring to?
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>OK, if you are using TIBOTable, creating a fkCalculated field *is* the only way to get a calculated column, i.e. it is forced upon you because you have no control over the query statement (SELECT * FROM ATABLE) which is used to acquire the dataset.
> > 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.
If you were using TIBOQuery, you could bring the calculated column across to your app and disregard OnCalcFields, e.g.
SELECT *,
'Details : ' ||Ldh_Name_FirstName||' '|| Ldh_Name_Surname AS
Ldh_Name_Details
from LeadHdr
WHERE <restricting clause>
In your dataset you would then have a read-only column named Ldh_Name_Details. Does this help you to understand what I was referring to?
> >Do you mean your OnCalcFields event? This event occurs when the dataset is opened and again whenever a row gets modified. Are you trying to call the CalcFields event handler from another handler when these conditions don't apply? You can't force a change to the handler code at other times...This isn't an IBO restriction - it's the way Delphi's CalcFields works.
> > 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'
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________