When you click the Field Integrity tab on the Field Edit page in the Data Builder, VPM Enterprise displays the Fields - Integrity page. You use the Integrity page to set up the validation rules for a field. Your selections and entries on the Integrity page determine how a field is validated when it is edited on a form.
You should rarely have to write any code to validate fields on your data entry forms. The Integrity page on the Data Builder makes it easy for you to enter sophisticated validation rules for any field.
Users can do it!: If you include the VPM Enterprise Data Manager in your application, the users can set up field validation for themselves. Often only users know how a field should be validated. VPM Enterprise makes user validation set up possible and easy.
Data Integrity: VPM Enterprise enforces full data integrity. Data integrity means data must be valid. Enforcing data integrity means that VPM Enterprise makes sure that an application's data complies with the set of validation rules you enter through the Data Builder.
Data integrity involves entity, domain and referential integrity. Briefly, hereís how VPM Enterprise handles data integrity:
Entity integrity means that primary keys cannot be null or duplicated. When you identify a tableís primary key on the tableís Data Builder Properties page, VPM Enterprise automatically sets up validation rules for the primary key fields to prevent null or duplicate values from being entered when adding or editing data on application forms.
Domain integrity means that every field value must be a member of a predefined domain. You define a fieldís domain through the Integrity page on the Data Builder. You can define a fieldís domain as a range of values, a set of values, a table of values or as simply not blank. You can also enter program code to define a domain.
Referential Integrity means that if a table, view or CursorAdapter includes a foreign key matching a primary key of another table, view or CursorAdapter, every value of the foreign key must be equal to the value of a primary key in the other table, view or CursorAdapter. Referential integrity must also take into account what happens to foreign keys when a primary key value is changed or deleted.
In VPM Enterprise you set up referential integrity for foreign key fields through the Integrity page on the Data Builder. The Integrity page lets you identify the table, view or CursorAdapter that contains the matching primary key. It also lets you map the foreign key fields to their corresponding primary key fields. For both primary key changes and deletions, you can choose one of the following four referential integrity rules to apply to the foreign key: (1) restrict, (2) set empty, (3) cascade or (4) no change.
When users add or edit foreign key fields on application forms, VPM Enterprise prevents foreign key values that donít match a related primary key. When users change or delete a primary key, VPM Enterprise applies the referential integrity rule you have selected to tables, views and CursorAdapters with matching foreign keys.
Whoa!: You're probably saying, "I thought Visual FoxPro handled entity and referential integrity!" You're right. Visual FoxPro does, but it's implementation of entity and referential integrity is not as robust as VPM Enterprise's implementation. Therefore, we encourage you to use the VPME implementation.
Tip - Required Fields: The field validation rules in a VPM Enterprise application are fired when the focus moves off a field on a form. If you have fields on a form that require an entry before a record can be saved, see Required Fields in the Creating Forms: Tips & Techniques chapter to learn how to implement required fields.