Ordering Lookup Entries - Grid Component
Description
Often you will want to display a list of values selected from a table. It is often desirable to specifically order these entries, instead of allowing them to display in record order or alphabetically. Here is a technique for solving this problem. This example uses a drop down list box on a dialog component, but the technique works equally well with a list box on a grid component.
Select the control that will display the list and set the Control Settings > Control type value to "DropDownBox".
Click the '...' button in the DropDownBox Properties > Choices property to display the Define Choices dialog.
Set the Define Choices > List Type value to "Dynamic".
Set the Data Source > Data source type to "DBF-Table".
Select the lookup table in the Data Source > Table name list.
Enter an expression similar to the following in the Data Source > Display value field/expression property.
table.external_record_content_get("<table_name>", "<display_field>", "<sort_field>")
Select the field you want to store in the Data Source > Stored value field/expression property.
In this particular example, the table contains the following values.
- Sequence Field
- Display Field
- "a"
100
- "f"
1000
- "g"
1250
- "h"
1500
- "b"
200
- "i"
2000
- "c"
250
- "j"
2500
- "d"
500
- "e"
750
When the user clicks the list box, the following list appears.
See Also