Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Field validation rule
Message
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 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01444944
Message ID:
01444985
Vues:
31
>>>Naomi,
>>>
>>>I am using a database with record validation rules that update a timestamp.
>>>Adding this field validation would require a row change to make the update, correct?
>>>
>>>Thanks,
>>>Al
>>
>>Yes, only when the record changes, the field will be updated.
>
>OK, thanks. I guess in the browse context there is no way to change a field within the field rule without recursive triggering.


Al,

You can change the contents of a field in the table's validation rule - regardless of whether the record was changed in a browse window or not
The table rule will not run recursively


Code
&& somewhere in the record validation rule

if( FieldChanged('TheNameOfTheField') )
    replace TheNameOfTheField with YourChangedContents
endif
*--------------------------------------------------------------------------
function FieldChanged(FieldName)

	do case
	case isnull(oldval(m.FieldName)) or Isnull(eval(m.FieldName))
		return (isnull(oldval(m.FieldName)) <> Isnull(eval(m.FieldName)) )
	otherwise
		return (oldval(m.FieldName) <> eval(m.FieldName))
	endcase
endfunc
*-------------------------------------------------------------------------
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform