0 Replies Latest reply on Jun 3, 2014 4:03 PM by EdKessler

    FMP 11 Creating an audit trail field

    EdKessler

      Title

      FMP 11 Creating an audit trail field

      Post

           I've been working for some time on creating a audit trail calculation field to document who make changes on a DB.  The DB has around 10 fields to track.  I found the syntex online and have modified the field names to my DB.  I still can't get it to work.  If someone would be willing to take a look at it and provide some feedback, I would appreciate it.  It's a DB to track two way radio equipment.

           Let ( [

            
              DepartmentPrev = Substitute ( MiddleValues ( AuditFields1 ; 1 ; 1 ) ; "¶" ; "" ) ;
              Radio SNPrev = Substitute ( MiddleValues ( AuditFields1 ; 2  ; 1 ) ; "¶" ; "" ) ;
              Radio MODELPrev = Substitute ( MiddleValues ( AuditFields1 ; 3 ; 1 ) ; "¶" ; "" ) ;
              BPIPrev = Substitute ( MiddleValues ( AuditFields1 ; 4 ; 1 ) ; "¶" ; "" ) ;
              Vehicle # UserPrev = Substitute ( MiddleValues ( AuditFields1 ; 5 ; 1 ) ; "¶" ; "" ) ;
              RADIO EIDPrev = Substitute ( MiddleValues ( AuditFields1 ; 6 ; 1 ) ; "¶" ; "" ) ;
              BCSALIASPrev = Substitute ( MiddleValues ( AuditFields1 ; 7 ; 1 ) ; "¶" ; "" ) ;
              NOTESPrev = Substitute ( MiddleValues ( AuditFields1 ; 8 ; 1  ) ; "¶" ; "" ) ;
              USE STATUSPrev = Substitute ( MiddleValues ( AuditFields1 ; 9 ; 1 ) ; "¶" ; "" ) ;
            
              DepartmentCur = Substitute ( Department ; "¶" ; "•" ) ;
              Radio SNCur = Substitute ( Radio SN ; "¶" ; "•" ) ;
              Radio MODELCur = Substitute ( Radio MODEL ; "¶" ; "•" ) ;
              BPICur = Substitute ( BPI ; "¶" ; "•" ) ;
              Vehicle # UserCur = Substitute ( Vehicle # User ; "¶" ; "•" ) ;
              RADIO EIDCur = Substitute ( RADIO EID ; "¶" ; "•" ) ;
              BCSALIASCur = Substitute ( BCSALIAS ; "¶" ; "•" ) ;
              NOTESCur = Substitute  ( NOTES ; "¶" ; "•" ) ;
              USE STATUSCur = Substitute ( USE STATUS ; "¶" ; "•" )] ;
            
           Case (
            
           DepartmentCur ≠ DepartmentPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & DepartmentPrev & "\" to \"" & DepartmentCur & "\"¶" ;
            
           Radio SNCur ≠ Radio SNPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & Radio SNPrev & "\" to \"" & Radio SNCur & "\"¶" ;
            
           Radio MODELCur ≠ Radio MODELPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & Radio MODELPrev & "\" to \"" & Radio MODELCur & "\"¶" ;
            
           BPICur ≠ BPIPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & BPIPrev & "\" to \"" & BPICur & "\"¶" ;
            
           Vehicle # UserCur ≠ Vehicle # UserPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & $ Vehicle # UserPrev & "\" to \"" & Vehicle # UserCur & "\"¶" ;
            
           RADIO EIDCur ≠ RADIO EIDPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & $ RADIO EIDPrev & "\" to \"" & RADIO EIDCur & "\"¶" ;
            
           BCSALIASCur ≠ BCSALIASPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & $ BCSALIASPrev & "\" to \"" & BCSALIASCur & "\"¶" ;
            
           NOTESCur ≠ NOTESPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & $ NOTESPrev & "\" to \"" & NOTESCur & "\"¶" ;
            
           USE STATUSCur ≠ USE STATUSPrev ; Get ( CurrentHostTimeStamp ) & ": " & Get ( AccountName ) & " changed " & Get ( ActiveFieldName ) & " from \"" & $ USE STATUSPrev & "\" to \"" & USE STATUSCur & "\"¶" ;
            
           ))
           & AuditLog1