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