Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datetime of field change
Message
De
01/02/2007 17:34:04
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
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Divers
Thread ID:
01191228
Message ID:
01191651
Vues:
13
>>>I would like to do a simple (I hope) validation rule for a true-false field so that when the field is changed to false, the datetime is recorded.
>>>
>>>I thought it would be easy to set a validation rule for the logical field, but I'm missing something. Can anyone provide a simple example for me?
>>>
>>>TIA
>>
>>Simple expressions simply return .T. or .F.
>>
>>However, you might invoke a UDF - which can be stored in the database stored procedures - which does the replace. I am not sure, though, whether this might generate an "illegal recursion" if you do it from a field validation. IIRC, something like this regularly happens when you try to pull the same trick from a trigger.
>
>OK, so maybe I should do an 'insert into' another table to track the change?
>
>If I do that, since I'm only tracking one field, should I call a function from a field validation rule or from a table update trigger?

I would say, a trigger. I don't really trust field validation, or record validation, for that matter - they tend to fire too early. For example, a field validation: As soon as the user leaves the TextBox, the change will be recorded - and yet, the user might issue a TableRevert()!

Also, with triggers you can even track deletions. I don't think that can be done with record validation.

To record changes to another table, see my article "A basic audit-trail", Universal Thread Magazine, May 2003, Article #1476.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform