Subject TIB_Lookup and multiple keys
Author mkl20uk
I can't understand the following behaviour.

A TIB_Grid has two embedded TIB_LookupCombos. Each lookup dataset has
two prime keys and the SQL statement supporting the grid has two
emebedded select statements. I am sure that the KeySource, KeyLinks
and KeyDescLinks have been defined properly.

When updating a record the grid, a record can be selected from each
of the embedded TIB_LookupCombo controls but the moment the record in
the grid is posted the values displayed for the looked up values
changes to incorrect values. Clicking on the column containing the
lookupcombo causes the lookupcombo to be displayed with the correct
value but clicking on any other column causes the lookup value to be
incorrect (obviously the lookupcombo is not displayed when the column
is no longer selected).

Changing this so that the lookup datasets only use one key and
everything works fine.

Main query for grid is:
-------------
part of SQL:

SELECT ...
...
ORL_TMP_WHO_REF,
ORL_TMP_WHO_SREF,
(SELECT WHO_DESC FROM WAREHOUSES W1
WHERE W1.WHO_UNIQUE_REF = O1.ORL_TMP_WHO_REF AND
W1.WHO_SYSTEM_REF = O1.ORL_TMP_WHO_SREF) as WAREHOUSE,
ORL_TMP_WLOC_REF,
ORL_TMP_WLOC_SREF,
(SELECT WLOC_DESC FROM WLOCATIONS W2
WHERE W2.WLOC_UNIQUE_REF = O1.ORL_TMP_WLOC_REF AND
W2.WLOC_SYSTEM_REF = O1.ORL_TMP_WLOC_SREF) as LOCATION
FROM ORDERLINES O1

Lookup1
-------
SQL is:
SELECT WHO_UNIQUE_REF
WHO_SYSTEM_REF
WHO_DESC
FROM WAREHOUSES
ORDER BY WHO_DESC

KeyLinks:
WAREHOUSES.W1.WHO_UNIQUE_REF = ORDERLINES.ORL_TMP_WHO_REF
WAREHOUSES.W1.WHO_SYSTEM_REF = ORDERLINES.ORL_TMP_WHO_SREF

KeyDescLinks:
WAREHOUSES.WHO_DESC=WAREHOUSE

Lookup2
=======
SQL is:
SELECT WLOC_UNIQUE_REF,
WLOC_SYSTEM_REF,
WLOC_WHO_UNIQUE_REF,
WLOC_WHO_SYSTEM_REF,
WLOC_DESC
FROM WLOCATIONS

KeyLinks:
WLOCATIONS.WLOC_UNIQUE_REF = ORDERLINES.ORL_TMP_WLOC_REF
WLOCATIONS.WLOC_SYSTEM_REF = ORDERLINES.ORL_TMP_WLOC_SREF

KeyDescLinks:
WLOCATIONS.WLOC_DESC=LOCATION