Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Last Updated User
Message
 
 
To
29/03/2005 09:40:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00988451
Message ID:
00999692
Views:
67
>Nadya,
>
>A short test over here shows what I expected. It works. No need to fix anything

It doesn't work for me. I open table and change values in fields directly. The two fields are not updated. Here is the code (yesterday I started to change it, haven't finished yet).
FUNCTION UpdateUserAndTime()
*  Function..........: UpdateUserAndTime
*  Author............: Gregory Adam thread #988451 / Nadya Nosonovsky / James Weil
*  Project...........: Visual Collections
*  Created...........: 02/02/2005  15:17:53
*  Copyright.........: (c) Jzanus, LTD, 2005
*  Major change list.:

LOCAL lcFieldState, lnPos, lnOccurance
IF CURSORGETPROP("Buffering") = 1 && Table is not buffered, update status
	REPLACE cLast_Updated_User WITH getuserid(), tLast_Updated_Date WITH DATETIME()
ELSE

	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(UPPER(FIELD(m.lnPos)), UPPER("cLast_Updated_User"), ;
				UPPER("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 = AT('2', m.lcFieldState, m.lnOccurance)
		ENDIF
	ENDDO
ENDIF

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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform