Subject | Re: [IBO] tib_lookupcombo and dataset containing null values |
---|---|
Author | Helen Borrie |
Post date | 2001-08-13T08:28:49Z |
At 07:38 AM 13-08-01 +0000, you wrote:
LookupID Description
0 '<None>'
1 'Cheese and chocolate'
2 'Escargots'
3 'Jalapeno and vanilla'
Because the KeySource dataset needs to point to an actual value, it isn't logical to allow a NULL in its pointer column - NULL=NULL won't find a "match", since both are non-values - NULL simply cannot perform as a key. For lookup keys you should define a default and/or NOT NULL, just to ensure that a new row never gets stored with a NULL there.
<sermon>
I don't consider the practice of doubling up the description value as both the lookup key and the lookup value is very sensible at all. For one thing, it creates redundancy in your database. For another, it means that you are "stuck" with that description value as your key. If you use an identifier column for the lookup row and store the identifier column value on the Keysource table, it makes it simple to alter the description without affecting existing relationships.
</sermon>
rgds,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>No, I don't want a NULL entry in the lookup table.Normally, one handles this in the lookup table, e.g.
>I just want a possibility to select a descriptive NULL entry from the
>lookup combo.
>
>Mario
LookupID Description
0 '<None>'
1 'Cheese and chocolate'
2 'Escargots'
3 'Jalapeno and vanilla'
Because the KeySource dataset needs to point to an actual value, it isn't logical to allow a NULL in its pointer column - NULL=NULL won't find a "match", since both are non-values - NULL simply cannot perform as a key. For lookup keys you should define a default and/or NOT NULL, just to ensure that a new row never gets stored with a NULL there.
<sermon>
I don't consider the practice of doubling up the description value as both the lookup key and the lookup value is very sensible at all. For one thing, it creates redundancy in your database. For another, it means that you are "stuck" with that description value as your key. If you use an identifier column for the lookup row and store the identifier column value on the Keysource table, it makes it simple to alter the description without affecting existing relationships.
</sermon>
rgds,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________