Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Last Updated User
Message
 
 
À
23/02/2005 12:08:29
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 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00988451
Message ID:
00989719
Vues:
62
>hi Nadya,
>
>The first part does not loop through all the fields. It loops through getfldstate(-1). If a byte indicates a change, then it finds out whether the field really has changed, excluding the user and time fields (you may want to add the insert fields there).
>
>It only loops until it finds a field that has changed.
>
>A recap,
>
>RecordValidation is only called when there is a change or it thinks so
>
>We may get a 'false' change, ie repl a field with a value and repl it back with the oldval(). Hence the loop
>
>We do not include the User and date fields of both the insert and update
>
>If you a shorter way I have overlooked, plse let me know
>
>
>cheers
FUNCTION UpdateUserAndTime()
*  Function..........: UpdateUserAndTime
*  Author............: Gregory Adam / Nadya Nosonovsky
*  Project...........: Visual Collections
*  Created...........: 02/02/2005  15:17:53
*  Copyright.........: (c) Jzanus, LTD, 2005
*  Major change list.:

LOCAL lcFieldState, lnPos, lnOccurance

lcFieldState = SUBSTR(GETFLDSTATE(-1),2) && The first character returns deletion status
lnOccurance = 1
lnPos = AT('2', m.lcFieldState, m.lnOccurance)
DO WHILE m.lnPos > 0
    DO CASE
	CASE !FieldChanged(FIELD(m.lnPos))
&& not changed

	CASE INLIST(FIELD(m.lnPos), "cLast_Updated_User", "tLast_Updated_Date")
&& ignore

	OTHERWISE
		REPLACE cLast_Updated_User WITH getuserid(), tLast_Updated_Date WITH DATETIME()
		lnPos = 0
	ENDCASE
	IF m.lnPos > 0
	   lnOccurance = m.lnOccurance + 1
	   lnPos = lnPos = AT('2', m.lcFieldState, m.lnOccurance)
	ENDIF	   
ENDDO

ENDFUNC
*--------------------------------------------------------------------------
FUNCTION FieldChanged(tcFieldName)

LOCAL llReturn

DO CASE
CASE ISNULL(OLDVAL(m.tcFieldName)) OR ISNULL(EVALUATE(m.tcFieldName))
	llReturn = (ISNULL(OLDVAL(m.tcFieldName)) <> ISNULL(EVALUATE(m.tcFieldName)) )
OTHERWISE
	llReturn = (OLDVAL(m.tcFieldName) <> EVALUATE(m.tcFieldName))
ENDCASE

RETURN m.llReturn

ENDFUNC
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform