c++ builder 2010 - example lookup in a tdbgrid

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

c++ builder 2010 - example lookup in a tdbgrid

Post by albourgz » Tue 20 Apr 2010 13:35

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 .

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 21 Apr 2010 13:40

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.

Post Reply