Data Access User Manual > Rogue Wave Views Data Access Common Framework > Hints and Tips for Using Data Access > Foreign Tables > Using a Foreign Table to Convert Values
 
Using a Foreign Table to Convert Values
If you are using the foreign table to convert values, the value and display columns will be different columns in the foreign table. The values in a table object column are converted in the following way.
For each value in the column:
1. The value is searched for in the foreign table value column.
2. The row in which it is found is identified.
3. The foreign table value that is in the display column and the identified row is returned and displayed in place of the original column value.
Figure 6.10    Using a Foreign Table to Convert Values
In addition, a combo box is automatically displayed on a cell in a column that is connected to a foreign table. The combo box menu contains all the possible values that the cell can accept, that is, all the values that are contained in the foreign table display column.
This mechanism is completely reversed if the user edits a value in the display gadget.
1. The new value is searched for in the foreign table display column.
2. The row in which it is found is identified.
3. The value in the value column and the identified row, of the foreign table is returned to the table object (replacing the display value).
Note: A table column that uses a foreign table to convert values is automatically set as Constrained. This prevents any inconsistency that can arise from the user entering a new value that is not in the foreign table display column.
Using the Toggle Selector
When a DbField has a foreign table, it is possible to display the value domain. This can be done by selecting a particular style for the IliDbField.
You can use table combo box style to show the value domain in a pop-up menu. Another useful style, however, is the IliToggleSelectorStyle. This style enables you to display a set of toggle gadgets that show the domain of values.
Each toggle in the toggle selector corresponds to a foreign table row. Only one toggle can be checked at a time.
Figure 6.11    A Toggle Selector Connected to a Column with a Foreign Table

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.