How to Change a Foreign Key field into a Dropdown List

Previous Next

See Also

In the Definer, you can change the Lookup Method attribute of a relationship from Lookup Page (the default) to Dropdown List or Radio. This results in the appropriate lookup functionality automatically.

In some cases, you want to implement dropdown list or radio button functionality for a field without making conceptual changes at relationship level. For example, when there exists a conceptual relationship, but you don't want to make changes at generic (Definer) level.

To implement dropdown list functionality, if there is a conceptual relationship:

1. From the Web Designer catalog, open the appropriate page corresponding with the child.
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 DataSource usually starts with: Lookup.

The top area of the object tree now looks like this:

 

3. For the new TableDataSource object, set the Initial State property to: Query Records.

 

4. In the SearchColumnGroup and/or the ResultColumnGroup, insert a SelectColumnControl for each foreign key field to be displayed in a dropdown list.
5. For this SelectColumnControl, set the Data Source Name property to the name of the Lookup DataSource.
6. For this SelectColumnControl, set the Data Source Item property to the name of the parent column.
7. Now you can delete the existing TextColumnControls in the SearchColumnGroup and/or the ResultColumnGroup.
8. Save your changes.

If you want to use radio buttons instead of a dropdown list, use RadioColumnControls instead of SelectColumnControls.

A drop-down list has an empty value if it is not linked to a database table, or if it is linked to a non-mandatory column.