Pattern 9: Classic joined column

Previous Next

In this design pattern, in addition to or instead of a foreign key field, a name field from the parent table is shown.

For example, a Participants page contains a PERSON_ID field, and you want to add a (virtual) FAMILY_NAME field from a PERSON parent table.

To implement this joined column functionality, create the data structure and configure the lookup field:

Creating the data structure

1.From the Web Designer catalog, open the appropriate page.
2.From the Controls tab of the catalog, drag the TableDataSource object corresponding with the lookup page to the main (Page) object in the object tree.
The name of this TableDataSource usually starts with: Lookup.
The top area of the object tree now looks something like this:

WD_help0077

 

3.For the new Lookup TableDataSource object, set the Initial State property to: Query Records.
4.If more than 20 records need to be retrieved from the Lookup DataSource, change the Maximum number of records property to: 0.

Adding and configuring the lookup field

1.In the SearchColumnGroup or the ResultColumnGroup, insert the required Control for the joined column field to be displayed:
In single-record layout (that is: in the SearchColumnGroup or the SingleRecordResultGroup), you can insert any ColumnControl, for example a TextColumnControl.
However, you can also insert a SelectColumnControl or RadioColumnControl to display the retrieved values as radio buttons or as a dropdown list.
In multi-record layout (that is: the MultiRecordResultGrid in the GridGroup), you need to insert a GridCellControl.
2.For a (single-record) ColumnControl, set the Data Source Name property to the name of the added data source, in the example: Lookup PERSON TAKES PART AS PARTICIPANT1.
3.For a (multi-record) GridCellControl, set the Lookup Data Source Name (Behavior) property to the name of the added data source.
4.In both single-record and multi-record layout, set the Data Source Item property of the inserted control to the name of the "lookup" column, in the example: FAMILY_NAME.
5.Save your changes.

 

See Also

Page and Data Source Constructs