Sample VB Code for Hours of Instrument Usage Information from Analyst® Software Audit Trail


Date: 05/31/2018
Categories: Analyst Software

0 Votes
   Print    Rate Article:

For research use only. Not for use in diagnostic procedures.


Answer

Information about the hours of instrument usage can be obtained from the Analyst® software Audit Trail.

The Audit Trail data can be retrieved using IQuantAuditTrail interface methods NumEntries & GetEntry (see example below).
 
A Sample of VB Code:
 
Public Class Form1
Dim m_analyst As Analyst.Application ' main application object  Dim m_quantAuditTrail As QuantAuditTrailLib.IQuantAuditTrail ' Audit Trail object  Dim m_IRTContents As QuantRTLib.IRTContents 'Results Table RT Contents object
 
Private Sub GetAuditTrailData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetAuditTrailData.Click  Dim numEntries As Long = 0 ' No of Audit trail entries  Dim strUserName As String = "" ' User Name  Dim lDateTime As Long ' Date Time  Dim strChangeType As String = "" ' Change Type  Dim strReason As String = "" ' Reason  Dim strDetails As String = "" ' Details
 
 Try
 m_analyst = GetObject(, "Analyst.Application")
 
 'Active control (Open the Results table in Analyst)  m_IRTContents = m_analyst.ActiveControl
 
 ' Audit trail data pointer
 m_quantAuditTrail = m_IRTContents.GetAuditTrail
 
 ' No of entries in Audit Trail
 numEntries = m_quantAuditTrail.NumEntries
 
' Loop through the entries to retrieve UserName, DateTime, ChangeType, Reason and Details  For lIdx As Integer = 1 To numEntries Call m_quantAuditTrail.GetEntry(lIdx, strUserName, lDateTime, strChangeType, strReason, strDetails)
 
MessageBox.Show("User Name : " + strUserName + ", DateTime : " + lDateTime.ToString() + ", ChangeType :" + strChangeType + ", Reason :" + strReason + ", Details :" + strDetails)  Next
 
Catch ex As Exception
 MessageBox.Show(ex.Message)
 End Try
 End Sub
 
End Class