The FileValidationTable class, a subclass of DescriptionValidationTable, makes it easy to load your data and descriptions from a table. You do this by setting properties to define the table’s file number; the fields for the data value (the code) and the description, and the index used to load the records.
The following example will create a validation table, which will load its data from a table named CustStat whose first field contains the data value and the second field contains the description. It will load all records using Index 1 of CustStat.
Object oStatusTable is a FileValidationTable
Set Main_File to CustStat.File_Number
Set Code_Field to 1 // code is in field 1
Set Description_Field to 2 // description is in field 2
Set Ordering to 1 // load by index 1
End_Object
Actually, the default values for Code_Field, Description_Field and ordering default to the above values, so this object could actually be defined as follows:
Object oStatusTable is a FileValidationTable
Set Main_File to CustStat.File_Number
End_Object
A validation table is a batch-based table. All items are loaded at one time. Therefore, it is expected that the list of items in any validation table will be (reasonably) short and will be static (once the table is loaded, the contents of the list will not change) throughout any session in which it is used. If you have many items or your item list is dynamic, you need an actual relationship between these tables and to use relational validation and lookup techniques.
If your list of valid items remains small but may change during usage sessions, you can create a non-static validation table by setting the Static_State property to false. When you do this, the table is always refilled before it is used for validation and the display list(s) (combo list, prompt list) is refilled each time it is displayed. Creating a non-static table will slow down processing because the validation table will be constantly refilling. If the number of items is small enough, this slowdown will not matter.
Additional properties named Type_Field and Type_Value can be used to load a subset of records from a table. When these are used, only records whose value in Field Type_Field matches the value of Type_Value will be loaded. When you constrain the records thus, make sure that your ordering index is optimized to ensure fast loading (index should be made up of Type_Field + Code_Field). You will probably never need to use these properties because the subclass, CodeValidationTable, provides the means and the table to accomplish this directly.