Subject Re: [IBO] TIB_LookupCombo
Author Lucas Franzen
Alfred,


Alfred Thomas schrieb:

> Hi All
>
> Can anyone please give me a short description of how to use TIB_LookupCombo.
> I cannot figure out how the lookup list is populated. In IBX I use
> ListSource/ListField.

Tie it to a separate query that retrieves the lookup values.

The KeySource property should point to the "master" query you're
showing/editing/inserting the records.

Then use the KeyLinks property so that the primary key of the lookup
entry is pointing to the desired record of the master query.

For example:
CREATE TABLE CUSTOMER (
CUST_ID INTEGER,
COUNTRY_ID INTEGER,
...
)

CREATE TABLE COUNTRIES (
COUNTRY_ID INTEGER,
COUNTRY_NAME VARCHAR(40),
...
)

If you want to show the country of the customer, you have:

QryCustomer: SELECT * FROM CUSTOMER WHERE ....
QryCountry : SELECT <FIELDLIST> FROM COUNTRY

QryCountry.KeySource is set to the Datasource of the QryCustomer
QryCountry.KeyLinks = COUNTRIES.COUNTRY_ID=CUSTOMER.COUNTRY_ID
(i.e. tell the QryCountry which value it should use; it will show the
field you've defined as DisplayField)

Now everything is working without anything else to do.
If you open an existing record you'll see the Countryname (or whatever
you defined as the DisplayField of the TIB_LookupCombo).

It you change a record or insert a new one you can just select the
country you like an IBO takes care that the proper value (COUNTRY_ID) is
written to the customer table.

If you want to delete the entry, just press the <DEL> key when in the
LookupCombo.

HTH

Luc.