Documents

NextGrid & NextDBGrid

NextGrid

NextDBGrid

NextInspector

NextSheet

NextCollection

Misc

Labs

NextGrid .NET

LookupColumn Tutorial

Related Articles:

Info
  • Skill:
  • Version: 1.0.1
  • Author: Bojan Nikolic
  • Created:
  • Updated: 2008-04-22

Introducing



With using Lookup Column we can combine Fields of 2 Tables or Queries to get result similiar when using SQL Join commands.

Sometime we need to represent Field from first table with using Values from second Field. To do this, we need to link this 2 Fields with using properties from TNxLookupColumn.

TNxLookupColumn is located at the secong "Tab" inside Next DBGrid Columns Editor.

Example Tables



In this example we have 2 tables: Articles and ArticleTypes.

We need to link ArticleTypeId Field from first Table to Id Field from second Table.



Set Lookup Column



Now, we will set TNxLookupColumn:

1. Place 2 TTable (TADOTable, TIBTable, TZTable...) components and 2 TDataSource components on form.
2. Place NextDBGrid on Form and add one TNxLookupColumn.
3. Select this column and set next properties
4. Property FieldName will be set as usual to desired Field from first table - "ArticleTypeId"
5. Property KeyFieldName - Key Field from ArticleTypes Table. This property will have "Id" as Value.
6. ListDataSource - Set to second DataSource
7. ListFieldName - Set to displaying Field from second Table. In our case is "Name".

Was This Article Useful?

Comments

2008-07-15 22:53:16

For lookup column example, how setup lookup properties in runtime mode. ?

2008-07-18 12:32:49

Hello,

You simply need to use typecast

TNxLookupColumn(NextDBGrid.Columns[2]).ListDataSource...


I hope that it helps.

2009-03-06 09:41:41

Is it possible to use only keyboard to select items ? Incremental search or select by arrows ?

2009-03-06 09:44:29

Hello,

Keys are supported, but Incremental search not yet.

Best regards

2009-03-18 11:40:40

Is it possible to set "ListFieldName" using more than one column?

2009-03-18 11:51:54

Is it possible to set "ListFieldName" using more than one column?

Unfortunatelly by now it is not possible
Only constructive comments, code contributions... will be publishes. Questions, non-official discussion will not be published.