6. Attribute Validity Checks


A Validity check is a set of parameters that define the validity of an attribute value. VBSF allows you to set validity checks using the mapping tool and enforce them at runtime. The following validity checks may be defined:

Setting validity checks is a two step process. First the validity checks must be created and the validity parameters specified. Once the validity checks are defined they must be assigned to the attributes that require them in the Validity check field of the Attribute Mapping Form. You can assign one validity check to multiple attributes.

Validity checks are not automatically enforced. The runtime layer simply provides the necessary API to test the validity of the attributes of an object at any time. VBSF does not take any action if a validity checks fails (e.g. it will not prevent an object with invalid data from being saved to the database). It is the responsibility of your code to test the validity of an object and to take appropriate action when a validity check fails. For details on enforcing validity checks at runtime see section 9. Enforcing Validity Checks of the Programmer's Guide.

 

Defining Validity Checks

To create a validity check click on the "Validity Checks" folder in the tree, and chose the Object->New menu option. When prompted, enter the validity check name and click OK. A Validity Check object is then created and added under "Validity Check" folder.

To edit a validity check select it in the tree so its corresponding form will be displayed on the right hand side of the split pane as shown below:

mtvalchk.jpg (69637 bytes)

The following options may be set:

Data type. Select the attribute data type this validity check can be assigned to.

Required. Check this option if a value is required.

Not zero. Check this option if the value must be non-zero. This field is disabled if the Data type selected is not numeric.

Minimum. Enter the minimum value that can be assigned, or leave blank if none. This field is disabled if the Data type selected is BOOLEAN, BLOB, or MEMO.

Maximum. Enter the maximum value that can be assigned, or leave blank if none. This field is disabled if the Data type selected is BOOLEAN, BLOB, or MEMO.

Valid values. Enter all the allowable valid values separated by commas, spaces, or carriage returns. This field is disabled if the Data type selected is BOOLEAN, BLOB, or MEMO.

 

Next Section 

Return to Table of Contents