Board index » delphi » Problem: lookup list & multiple key fields

Problem: lookup list & multiple key fields

Hello,

Delphi help file states that more than one field can be specified in
LookupKeyFields/KeyFields, separating field names with semicolons.

Is there a hidden trick to get this thing working, since all I receive
is
error message "MyTable: Field 'MyField_1;MyField_2' not found" when
trying
to open "multi-field" lookup list in a DBGrid-component?

Asko Juvonen

 

Re:Problem: lookup list & multiple key fields


The following works for me:
aFound1 := DataCHAR.TblProgramWorker.Locate( 'PROG_ID;WORKER_CODE',
         VarArrayOf( [aID,aCode] ), [] );
Are you sure the field names are correct? You might need to try the field
name in uppercase.

Cheers,

David

Quote
Asko Juvonen wrote in message <3816B8D9.A96FF...@eela.fi>...
>Hello,

>Delphi help file states that more than one field can be specified in
>LookupKeyFields/KeyFields, separating field names with semicolons.

>Is there a hidden trick to get this thing working, since all I receive
>is
>error message "MyTable: Field 'MyField_1;MyField_2' not found" when
>trying
>to open "multi-field" lookup list in a DBGrid-component?

>Asko Juvonen

Re:Problem: lookup list & multiple key fields


Quote
>Delphi help file states that more than one field can be specified in
>LookupKeyFields/KeyFields, separating field names with semicolons.

>Is there a hidden trick to get this thing working, since all I receive
>is
>error message "MyTable: Field 'MyField_1;MyField_2' not found" when
>trying
>to open "multi-field" lookup list in a DBGrid-component?

There can't be any spaces in the string you specify.
What version of Delphi are you using?   There where problems with this in
Delphi3 that where fixed with the patches for that version.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Problem: lookup list & multiple key fields


Quote
Brian Bushay TeamB wrote:
> >Delphi help file states that more than one field can be specified in
> >LookupKeyFields/KeyFields, separating field names with semicolons.

> >Is there a hidden trick to get this thing working, since all I receive
> >is
> >error message "MyTable: Field 'MyField_1;MyField_2' not found" when
> >trying
> >to open "multi-field" lookup list in a DBGrid-component?

> There can't be any spaces in the string you specify.
> What version of Delphi are you using?   There where problems with this in
> Delphi3 that where fixed with the patches for that version.

> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

I am using Delphi 5 with Interbase 5.5.

There are no spaces in the string. Or there WERE no spaces since I didnt want
to waste
time on this issue any more: I changed the structure of my database so that I
need only one
field on KeyFields/LookupKeyFields. Obnoxious enough.

Asko

Re:Problem: lookup list & multiple key fields


Quote
Asko Juvonen wrote:

> Hello,

> Delphi help file states that more than one field can be specified in
> LookupKeyFields/KeyFields, separating field names with semicolons.

> Is there a hidden trick to get this thing working, since all I receive
> is
> error message "MyTable: Field 'MyField_1;MyField_2' not found" when
> trying
> to open "multi-field" lookup list in a DBGrid-component?

The problem is a limitation in data aware controls like TDBLookupListBox
and TDBLookupComboBox - they are based ob the assumption of just one key field.
They are designed to edit exactly one field. If a lookup control allowed
multiple key fields, it would also need multiple key values and every update
action would have to update multiple fields simultaneously. Nothing wrong with
that, but they just did not design them for that. A mistake, IMHO.

Karl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Karl Waclawek
   KD Soft Inc.
 * Phone:  (905) 579-3443
 * E-Mail: wacla...@idirect.com

Other Threads