Page 1 of 1

c++ builder 2010 - example lookup in a tdbgrid

Posted: Tue 20 Apr 2010 13:35
by albourgz
Hi,

I would like to find an example of lookup combobox in a TCRDBGrid.
Sample example:

Code: Select all

SQLWKS> desc cec.gaches
Column Name                    Null?    Type
------------------------------ -------- ----
IDGROUP                        NOT NULL NUMBER(9)
TYPE                           NOT NULL NUMBER(9)
SUBPRODUCT                     NOT NULL NUMBER(9)
CNT                                     NUMBER(8)
NEWCNT                         NOT NULL NUMBER(8)
PK is (idgroup, type,subproduct)

TYPE is a number, values should be available in column id of this table

Code: Select all

SQLWKS> desc cec.types
Column Name                    Null?    Type
------------------------------ -------- ----
ID                             NOT NULL NUMBER(4)
NAME                                    VARCHAR2(50)
where id is PK.

In column type in the grid editing cec.gaches, I would like to have a combo ordered by Types.Name, showing only Types.Name (not the id) but recording the id in cec.gaches(type).
Feasable???? I tried several fkLookup combinations: Not easy: for each field, having to specify key, id, result, ..; and it didn't work.
No sample in demos .

Posted: Wed 21 Apr 2010 13:40
by bork
Hello

You should add a lookup field to your dataset and a lookup column column for this field will be created automatically. You can define ordering in the source dataset for lookup field.

You can find more detailed information about lookup fields in the RAD Studio help.