Using Forall in Lotus Script

Could anyone please point me in the right direction. The code below is part of an agent which I have scanning through logs for when the user last logged in etc. The problem I have is at the moment the agent references a Profile document to check what server it should scan the logs on. I want to make this dynamic and remove the need for the profile document. As you can see below the ForAll statment references a profileDoc.ServerLOGsToScan. I would like to change this to use session.servername so it will get the current server name instead of the profiledoc. Does anyone have any ideas?

Thanks Steve

Sub Initialize

Call InitializeVariables

Call InstantiateObjectVariables



Forall Server In profileDoc.ServerLOGsToScan

	Set logdb = Nothing

	Set logdb = session.GetDatabase(Server,"LOG.NSF")

	If Not logdb Is Nothing Then

		Set logview = logdb.GetView("Miscellaneous Events")

		Call logview.Refresh

		Set logdoc = logview.GetLastDocument

		

		MoreToProcess = True

		While (Not logdoc Is Nothing) And (MoreToProcess)

			MoreToProcess =  ProcessLogDoc(Server)

			Set logdoc = logview.GetPrevDocument(logdoc)

		Wend

	End If     

End Forall



Forall UserName In UsersNotInNABList

	Call usersNotInNAB.AppendText(Listtag(UserName))

	Call usersNotInNAB.AddNewLine(1)

End Forall

Call reportDoc.Save(True, False)

End Sub

Subject: Using Forall in Lotus Script.

  1. remove the “Forall” loop2) replace

Set logdb = Nothing

Set logdb = session.GetDatabase(Server,“LOG.NSF”)

with

Set logdb = session.GetDatabase(session.CurrentDatabase.Server,“LOG.NSF”)

hope this helps!!

Subject: RE: Using Forall in Lotus Script.

Top Stuff. Removed the for all and replaced it with what you suggested, then set the string server to session.server so it could be used later in the script and now it works a charm.

Thanks for your help :slight_smile:

Steve