Subject Re: [IBO] TIB_LookupCombo in a Grid
Author Helen Borrie
At 02:57 AM 22-10-02 -0300, you wrote:
>I want to use a LookupCombo in a different way when embedded in a Grid.
>
>My KeySource SQL is like:
>SELECT ID
> , (SELECT DESCRIPTION
> FROM LOOKUPTABLE
> WHERE LOOKUPTABLE.ID = KEYSOURCETABLE.ID)
> AS LOOKUPTABLE_DESCRIPTION
> , ...
>FROM KEYSOURCETABLE
>
>And my LookUp SQL is like:
>SELECT ID, DESCRIPTION
>FROM LOOKUPTABLE
>
>When I'm using the LookupCombo bounded to the Description field, all works
>fine.
>
>But I'm intending to bind the LookupCombo to the ID field, so in the Grid
>I'd see the ID (bounded with the Lookup) and at its side the Description (a
>computed field).
>
>Can it be done?

Use KeyLinks to bind the ID of the lookup table to the (invisible) lookup
key of the keysource table.

If you want the lookup key to appear in its own column, make sure you
include it in the query! Just make it visible.

If you want the key + description to appear in one single column (and not
show the lookup key at all) then try:

SELECT ID
, (SELECT cast (LOOKUPTABLE.ID as varchar(16)) || ' ' ||
LOOKUPTABLE.DESCRIPTION
FROM LOOKUPTABLE
WHERE LOOKUPTABLE.ID = KEYSOURCETABLE.ID)
AS LOOKUPTABLE_DESCRIPTION
, ...
FROM KEYSOURCETABLE

and do

SELECT ID,
DESCRIPTION,
cast (ID as varchar(16)) || ' ' || DESCRIPTION AS L_DESCRIPTION
FROM LOOKUPTABLE

and then bind L_DESCRIPTION to KEYSOURCETABLE.LOOKUPTABLE_DESCRIPTION
via KeyDescLinks.

You don't have to show L_DESCRIPTION in the lookupcombo if you prefer not to.

I don't know whether this will work, but if it is what you need, give it a try!

Helen



Helen