msgbox with all agents and their lastrun property

Normally you check the LastRun property of an agent by right clicking on the Agent in the designer and accessing the log. When you have to check a lot of agents and their LastRun property, this agent may come in handy. It presents a message box with all agents in de current database ordered alphabetically with their LastRun property.

 Sub Initialize
 Dim session As New notessession
 Dim db As notesdatabase
 Set db=session.Currentdatabase
' Declare 
 Redim AgentName(0) As String
 Redim AgentLastRun(0) As String
 Dim Counter As Integer
 Dim Sorted As Integer
 Dim S1, S2 As String 
 Dim First_string As String
 Dim Second_string As String
 Dim Out As String
 Dim i As Integer
' Initialize 
 Counter = 0 
 Sorted = False 
 Forall agent In db.agents
  AgentName(Counter) = agent.Name
  AgentLastRun(Counter) = Cstr(agent.Lastrun)
  Counter = Counter +1
  Redim Preserve AgentName(Counter+1) As String
  Redim Preserve AgentLastRun(Counter+1) As String
 End Forall
' Start BubbleSort
 Do While (Sorted = False)          
  Sorted = True
  For i = 0 To Counter - 2
   S1 = AgentName(i)
   S2 = AgentName(i+1)
   If(Strcomp(s1, s2, 5) = 1) Then
    First_string = AgentName(i)
    Second_string = AgentLastRun(i)
    AgentName(i) = AgentName(i+1)
    AgentLastRun(i) = AgentLastRun(i+1)
    AgentName(i+1) = First_string
    AgentLastRun(i+1) = Second_string
    Sorted = False
   End If
' End BubbleSort
 For i = 0 To Counter-1
  ' a futile attemp to align the output :-)
  Out = Out + Left((AgentName(i) + ".................................................."),50) & AgentLastRun(i) & Chr(10)
 Messagebox Out
End Sub

This was first published in July 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.