Subject Re: [IBO] LookupCombo
Author Dave Bullar
Thanks Helen.
I may be nearly there, see my reply to Geoff. But I am somewhat thrown by
your (and Jason's )frequent use of the word 'Key' . I am a self taught
programmer (of data bases, I spent most of my 40 years of programming with
assembler and embedded instrumentation systems) so I suspect there is a hole
there in my education somewhere. I supose it stands for 'Key Field'. How
about a definition of 'Key' for me ?
I know about Primary 'Key' and Foreign 'Key' and that these are fields that
must hold unique values and are often also an index, is that it ? Mind you,
I do get hung up on terms. I got all behind at Maths because when the
lecturer talked about 'weighting functions' I wrote it down as 'waiting
functions' and could not follow the logic of it!
regards Dave.
----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, April 30, 2001 3:24 PM
Subject: Re: [IBO] LookupCombo


> At 01:17 PM 30-04-01 +0000, you wrote:
>
> > Yes I dont have BDE installed I do use all IB_Objects controls. It
> >is just getting my mind around various controls and their intended
> >way of operation I find difficult.
> >The ibojects dbcombo does not have a 'list source'
>
> The architecture of the IB_ controls is quite different to that of the
Delphi VCL. The IB_ datasets drive the behaviour of the controls. The
"equivalent" of the ListSource and ListItem properties is achieved by using
special properties to set up the "KeySource-Lookup" relationship.
>
> The KeySource dataset is the one in which the lookup keys are stored. The
Lookup dataset is a set containing one and only one row for each possible
lookup key. It can contain keys which do not exist in any row of the
KeySource set. Normally, you would use one lookup dataset for each lookup
key in the KeySource set, i.e. the primary key column (or columns) of the
lookup table and the associated description column.
>
> If you use the Object Inspector to enter the linking properties
(recommended, if you are setting this up at design time) then you will have
these properties to set on the Lookup query:
>
> KeyLinks
> MyLkpQuery.IDField=MyKeySourceQuery.LookupID
>
> KeySource
> dsMyKeySourceQuery (selected from drop-down list)
>
> If you wish, you can create a DEFAULT in the ColumnAttributes for the
lookup key of the KeySource dataset. If that's the behaviour you want, just
make sure there is a corresponding row in the Lookup set and the default
will appear when the INSERT happens.
>
> >so the queries
> >have to be linked as you indicate, but at this point the main table
> >holds a blank record apart from its primary key which is placed there
> >from a generator. The combo is connected to the lookup table and is
> >showing the list of town to select...what happens next ?
>
> If you have this set up properly, and no DEFAULT defined for the lookup
key in the KeySource set, the editbox portion of the ib_LookupCombo should
just display a blank until the user picks something; and null will be
stored in the lookup key field if the database allows it.
>
> >I am using delphi4 and ib_query and ib_datasource for both tables as
> >required.
>
> >(When the user presses the 'check' button the data is transferred
> >from the lookup to the main record...but this is no different from
> >using non data-aware components).
>
> No "button" action is required to "transfer" data: if the linking is
correct, the relationship is formed in the datalinks and the selected lookup
key will be placed where it belongs automatically. There is no handler code
to write, as one does with non-data-aware controls....
>
> Cheers,
> Helen
>
> All for Open and Open for All
> InterBase Developer Initiative ยท http://www.interbase2000.org
> _______________________________________________________
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>