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