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