>> 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 ; >> IIF(VARTYPE(m.gcUserID) == "C", m.gcUseriID, 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 >>>
>REPLACE cLast_Updated_User WITH ; > IIF(VARTYPE(m.gcUserID) == "C", m.gcUseriID, getuserid()), ; > tLast_Updated_Date WITH DATETIME() >FieldChanged is a separate function. My question is how can I simplify the above logic and how can I avoid repeating this logic in the trigger...