Manage Learn to apply best practices and optimize your operations.

msgbox with all agents and their lastrun property

Check a multiple agents and their last run 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

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...