Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why Trigger failed, more details...
Message
De
25/01/2003 07:46:16
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00743645
Message ID:
00745385
Vues:
23
>Can we put !EMPTY(MyField) in field level validations. If so then what when the DBC rejects dues to an empty field

Of course we can. We can put any expression that VFP considers valid.

However, I don't like field-level validation, or record-level validation either, for that matter. The reason I don't like them is because they can fire too early - you can't say "evaluate those rules later". Field-level validation is fired as soon as the user leaves the field.

The framework I use has a Form.Valid() event: I can insert validation rules there. The validation rules are evaluated when the user tries to save the record.

Eventually, I ended up calling a single rule for each form, RecordValid("MyTable"). I defined RecordValid() as a UDF that checked rules I stored in a table, and showed the user the corresponding error messages.

The fields in the validation table are Table, Rule, ErrorMessage, and a number indicating how strict the rule should be followed (can't save at all; warning, but user can save; and ignore completely).

Rules evaluated this way are not strict, in the sense that you can bypass them in individual forms, or in the BROWSE window.

To make the validation rules strict, I would call them from a trigger.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform