Subject Re: [IBO] Lookup issue
Author paulo@tgr.com.br
Thanks Helen.
I don't know if what I'm trying to do is so stupid or too much of
against good DB design. There are things that have fixed values like
gender=masc/fem and others.

For this fixed small stuff I have a table I call TYPES like this
INFOTYPE - INFOCODE - INFOVALUE
gender - 1 - Masc
gender - 2 - Fem
place - 1 - Country
place - 2 - State
place - 3 - City
Obviously, key fields = INFOTYPE and INFOCODE

To get a customer's gender it's very easy to look it up:

SELECT CUSTNO, CUSTNAME, (SELECT TYPES.INFOVALUE FROM TYPES WHERE
TYPES.INFOCODE = CUSTOMERS.GENDER AND TYPES.INFOTYPE='gender') AS
GENDER FROM CUSTOMERS

This seemed smart at first because it saves me a lot of work and I
didn't want to create a table for each little piece of info that
never changes.

This is why I'm having trouble with TI_LookupCombo:

TIB_LookupCombo.Datasource.Dataset.SQL = 'SELECT TYPES.INFOVALUE FROM
TYPES WHERE INFOTYPE = 'gender')
TIB_LookupCombo.Datasource.Dataset.KeyLinks
= 'TYPES.INFOCODE=CUSTOMERS.CUSTGENDER'

When the lookupcombo does his internal stuff here's what it does:
SELECT TYPES.INFOVALUE FROM TYPES WHERE INFOCODE = ?

Thus the multiple rows for the singleton select.

All I wanted was to have AND INFOTYPE = 'gender' added to it.

OK I take critic, please if there's no way I can do it, you can call
me crazy and tell me to look for treatment (ie a DB design course :-)