How to Change a Non-Foreign Key Field into a Dropdown List

Previous Next

See Also

In some cases, you want to implement dropdown list or radio button functionality for a field that is not a foreign key field, for example when there is a system table with domain-like values that you want to present in a dropdown list.

To implement this dropdown list functionality:

1. From the Web Designer catalog, open the appropriate page.
2. From the Controls tab of the catalog, drag the TableDataSource object that contains the values to be displayed to the main (Page) object in the object tree.

The name of this TableDataSource object is the table name in uppercase.

3. From the Controls tab of the catalog, drag a Lookup element to this new TableDataSource.
4. For all columns to be displayed in a dropdown list, drag a LookupColumn object to the Lookup element.

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

5. For the new TableDataSource object, set the Initial State property to: Query Records.
6. For the Lookup element, set the Synchronization DataSource property to the path to the "child" table, for example:

RESERVATION

7. For each Lookup column, set the Data Source Item property to the name of the "lookup" column (the primary key) of the added data source, for example: PERCENTAGE.
8. For each Lookup column, set the Synchronization Column property to the name of the "target" column (the foreign key) of the other data source, for example: RESERVATION_DISCOUNT.
9. In the SearchColumnGroup and/or the ResultColumnGroup, insert a SelectColumnControl for each field to be displayed in a dropdown list.
10. For this SelectColumnControl, set the Data Source Name property to the name of the added data source, in the example: DISCOUNT1.
11. For this SelectColumnControl, set the Data Source Item property to the name of the "lookup" column, in the example: PERCENTAGE.
12. Now you can delete the existing TextColumnControls in the SearchColumnGroup and/or the ResultColumnGroup.
13. Save your changes.

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