Sub ShowLog(pTableName as string, pUUID as string) // Load the Audit Log dim sql as string dim auditLogRS as RecordSet dim theHTML as string dim theFieldValuesNames, theFieldValuesValues as string dim theStringToRemove as string dim theStringToRemoveBegin, theStringToRemoveEnd as integer sql = "SELECT Action, FieldValues FROM LogAudit WHERE TableName = '" + pTableName + "' AND TableKey = '" + pUUID + "' ORDER BY ModTS DESC, ModSeconds DESC ;" auditLogRS = app.dbMain.SQLSelect( sql ) If auditLogRS <> Nil Then While Not auditLogRS.EOF // Process the FieldValues theFieldValuesNames = auditLogRS.Field("FieldValues").StringValue theFieldValuesValues = theFieldValuesNames // Remove the Values from Names and Names from Values using M_String from Kem Tekinay, MacTechnologies Consulting (ktekinay@mactechnologies.com) theFieldValuesNames = m_string.ReplaceRegEx( theFieldValuesNames, app.AuditLogFieldValueBegin.Replace( "]", "\]" ) + ".*" + app.AuditLogFieldValueEnd.Replace( "[", "\[" ), "", false ) theFieldValuesValues = m_string.ReplaceRegEx( theFieldValuesValues, app.AuditLogFieldNameBegin.Replace( "]", "\]" ) + ".*" + app.AuditLogFieldNameEnd.Replace( "[", "\[" ), "", false ) '// Remove the Values from Names and Names from Values without RegEx 'while theFieldValuesNames.InStr( app.AuditLogFieldValueBegin ) > 0 'theStringToRemoveBegin = theFieldValuesNames.InStr( app.AuditLogFieldValueBegin ) 'theStringToRemoveEnd = theFieldValuesNames.InStr( theStringToRemoveBegin, app.AuditLogFieldValueEnd ) 'theStringToRemove = theFieldValuesNames.mid( theStringToRemoveBegin, theStringToRemoveEnd + len( app.AuditLogFieldValueEnd ) - theStringToRemoveBegin ) 'theFieldValuesNames = theFieldValuesNames.replaceall( theStringToRemove, "" ) 'wend 'while theFieldValuesValues.InStr( app.AuditLogFieldNameBegin ) > 0 'theStringToRemoveBegin = theFieldValuesValues.InStr( app.AuditLogFieldNameBegin ) 'theStringToRemoveEnd = theFieldValuesValues.InStr( theStringToRemoveBegin, app.AuditLogFieldNameEnd ) 'theStringToRemove = theFieldValuesValues.mid( theStringToRemoveBegin, theStringToRemoveEnd + len( app.AuditLogFieldNameEnd ) - theStringToRemoveBegin ) 'theFieldValuesValues = theFieldValuesValues.replaceall( theStringToRemove, "" ) 'wend // Convert the tagged data to HTML table columns. theFieldValuesNames = theFieldValuesNames.ReplaceAll( app.AuditLogFieldNameBegin, "" ) theFieldValuesNames = theFieldValuesNames.ReplaceAll( app.AuditLogFieldNameEnd, "" ) theFieldValuesValues = theFieldValuesValues.ReplaceAll( app.AuditLogFieldValueBegin, "" ) theFieldValuesValues = theFieldValuesValues.ReplaceAll( app.AuditLogFieldValueEnd, "" ) // Build the HTML for the HTML Viewer if theHTML = "" then // Start with HTML Top Stuff theHTML = theHTML + "" + _ "" // Add column headers theHTML = theHTML + "" theHTML = theHTML + "" theHTML = theHTML + theFieldValuesNames theHTML = theHTML + "" end if // Append a Row theHTML = theHTML + "" theHTML = theHTML + "" theHTML = theHTML + theFieldValuesValues theHTML = theHTML + "" auditLogRS.MoveNext Wend auditLogRS.Close theHTML = theHTML + "
When Action
" + auditLogRS.Field("Action").StringValue + "
" // Show the Audit Log AuditLogHTMLViewer.LoadPage( theHTML ) self.show End If End Sub