Subject | Re: [IBO] TIB_LookupCombo and MasterLinks |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-03-10T14:04:48Z |
At 02:33 PM 10-03-02 +0100, you wrote:
works perfectly provided you want to store a key and not the
DisplayField. However, it is possible to make it work the way you want,
but you must make absolutely certain that there are no duplicate values and
no nulls in the description fields (one empty-string value is OK). The
best way to ensure this is to place a unique index on that column.
The lookup dataset should not select the primary key of the lookup table,
but should instead "fudge" the key by picking up the Description column as
if it were the primary and then picking it up again as an alias, for
populating the DisplayField. Here is the SQL:
SELECT Description, Description AS Descr
from MyLookupTable
ORDER BY Description
In the KeyLinks of this dataset, enter:
MyLookupTable.Description=ParentTable.DescrField
This assumes that the Parent (or "Keysource") table wants the value to go
into a column named DescrField. It can be whatever you need, of course!
Set the Keysource property of the lookup dataset to be the datasource that
is pointing to ParentQuery. (Don't confuse this with the Datasource
property: leave this as nil.)
Set the Visible property of Description to False.
Set the DisplayField property to Descr
That should do it.
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
www.ibobjects.com
>Hello!The linking paradigm to use is the KeySource-Lookup relationship. This
>
>I'd like to use a TIB_Lookupcombo in a grid.
>The LookupCombo should list some names from a mastersource and on
>selection the name (not some key) from the master source should be saved
>into the underlying table.
>
>Is that possible, and how?
works perfectly provided you want to store a key and not the
DisplayField. However, it is possible to make it work the way you want,
but you must make absolutely certain that there are no duplicate values and
no nulls in the description fields (one empty-string value is OK). The
best way to ensure this is to place a unique index on that column.
The lookup dataset should not select the primary key of the lookup table,
but should instead "fudge" the key by picking up the Description column as
if it were the primary and then picking it up again as an alias, for
populating the DisplayField. Here is the SQL:
SELECT Description, Description AS Descr
from MyLookupTable
ORDER BY Description
In the KeyLinks of this dataset, enter:
MyLookupTable.Description=ParentTable.DescrField
This assumes that the Parent (or "Keysource") table wants the value to go
into a column named DescrField. It can be whatever you need, of course!
Set the Keysource property of the lookup dataset to be the datasource that
is pointing to ParentQuery. (Don't confuse this with the Datasource
property: leave this as nil.)
Set the Visible property of Description to False.
Set the DisplayField property to Descr
That should do it.
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
www.ibobjects.com