The validation-table classes provided (ValidationTable, DescriptionValidationTable, FileValidationTable, and CodeValidationTable) will probably handle all your validation-table needs. If they do not, you are encouraged create subclasses.
If you wish, you can create complete custom validation classes. You can make this class work any way you want as long as it supports the pre-defined interface. When a validation table is assigned to a field in a Data Dictionary, the Data Dictionary and the DEOs using it expect this validation table to adhere to a specific interface.
A validation table must support the following public interface:
Get Static_State to State
Get Validate_State to State
Get Validate_Value data_value to State
Get Number_Elements to Val
Send Request_Fill_From_List ObjectId MessageId
As you can see, this interface is quite simple and abstract. The actual methods for processing these requests are internal and may be quite complicated. As long as the interface is adhered to, you can make a validation table act any way you wish.
This property is used to specify whether display lists (popup prompt lists, combo drop-down lists, and radio lists) should be refilled each time they are required by a DEO. Normally, validation tables should be static (this property should be true).
It will be called as follows:
Get Static_State to bIsStatic
A typical class implementation of this might be:
Property Boolean Static_State True
This property specifies whether the list should be used for validation purposes. If true, you will have to define the message get Validate_Value.
It will be called as follows:
Get Validate_State to bPerformValidate
A typical class implementation of this might be:
Property Boolean Validate_State True
If Validate_State is true, the message Validate_Value will get sent to this object. It is passed the data value to be validated. Returning a zero value indicates that the value is valid; a non-zero value indicates that validation failed.
It will be called as follows:
Get Validate_Value sDataValue to bNotValid
The method used to validate this value is left entirely to the class. Here is a sample implementation for this method:
Function Validate_Value string sDataValue returns Boolean
Integer iItems i
String sData
Get Number_Values to iItems // number of items in validation table
For i from 0 to (iItems-1)
get Data_Value i to sData
If (sDataValue=sData) ;
Function_Return False // false = is valid
Loop
Function_Return True // true = is invalid
End_Procedure
This example assumes that your validation-table class defines and understands the messages get number_values and get data_value.
This determines how many elements are used to represent a data item. This is used by visual objects (prompt lists, combo forms, radio forms) to determine how to display data.
Currently the values 1 and 2 are supported.
1 - indicates that only a data (code) value is available
2 - indicates that both data and description values are available.
It will be called as follows:
Get Number_Elements to iNumOfElement
A typical class implementation of this might be:
Property Integer Number_Elements 2
This message is used when another object (prompt list, combo form, etc.) needs to be filled with valid values. When it is received, the validation object must send a specified message (MessageId) to a specified object (ObjectId), passing information about each item in the validation table.
The following information must be passed back to ObjectId: Item number, Data value, Description value, table number, and RowId. Item number and data value must contain information. If Description value, table number, or RowId do not exist, you may pass empty values ("", 0, and (NullRowId()) ), but five values must be passed back every time.
It will be called as follows:
Send Request_Fill_From_List iObjectId iMessageId
Here is a sample implementation for this method:
Procedure Request_Fill_From_List integer iObjectId integer iMessageId
Integer iItems i
String sDataVal sDescVal
Get Data_Item_Count to iItems // number of items in validation table
For i from 0 to (iItems-1)
get Data_Value i to sDataVal
get Description_Value i to sDescVal
Send iMessageId of iObjectId i sDataVal sDescVal 0 (NullRowid())
Loop
End_Procedure
This example assumes that your validation-table class defines and understands the messages get number_values, get data_value, and get description_value.
RowId is passed for compatibility reasons and is never actually used. You may always pass this as (NullRowId()).