Subject Re: [IBO] Field not found
Author Helen Borrie
At 11:04 AM 12/04/2005 +0200, you wrote:

> I use a TwwDBGrid with programmatically filled columns:
>
>with MyGrid.Selected do
>begin
> Clear;
> Add('DEBITOR' + #9 + '14' + #9 + 'Deb' + #9 + ');
> Add('ARTICLE' + #9 + '16' + #9 + 'Article' + #9 + 'T');
>end;
>
>I use a TwwSearchDialog with the same selected property.
>If I use the SearchDialog and search for a not existing value then an
>error shows up with "Column unknow DEBITOR".

Correctly, since your DEBITOR field is not a database column.

>
>The column DEBITOR is fetched with this TIBOquery:
>
>SELECT IVR_VERKP.DEB_KEY
> , IVR_DEB.AFK AS Debitor
> , IVR_ART.AFK AS Article
>FROM IVR_VERKP
>JOIN IVR_DEB ON IVR_DEB.P_KEY = IVR_VERKP.DEB_KEY
>JOIN IVR_ART ON IVR_ART.P_KEY = IVR_VERKP.ART_KEY

Debitor and Article are both derived fields. Search keys can't be formed
on derived fields, since they exist nowhere except in the output.


>I traced down the problem and figured out that it is concentrated on
>the properties KeyLinks and KeyRelation of the TIBOQuery in
>combination with the aliassed fields. If I remove the contents of
>KeyLinks and KeyRelation, all goes well. If I don't, and in my
>application I do need them, an error arises if I ask for a non
>existing value.
>
>Any ideas?

Yes. If you need these values to be part of the key, or to be updatable,
or to be referred to as search keys, they can't be derived fields. Since
you need all of these key fields in your KeyLinks, it is not an option for
you to alias them. If you want to display them with a different caption,
use the FieldsDisplayName property.

Helen