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 
 S1=""
 S2="" 
 First_string=""
 Second_string=""
 Out="" 
 
 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
  Next
 Loop
' 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)
 Next
 
 Messagebox Out
 
End Sub
This was first published in July 2002

Dig deeper on Domino Resources - Part 7

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close