It takes at best 30 seconds a doc. I have 13,000 documents. This is going to take a looong time.
Long story short, i want to post the mail file size into the person doc of each mail file, only for files in a particular view.
Lotus Notes Database Synopsis - Generated at 02:38:07 PM on 04/28/2005
Agent Information
Name: 2.DeploymentStoreSize
Last Modification: 04/28/2005 01:52:18 PM
Comment: [Not Assigned]
Shared Agent: Yes
Type: LotusScript
State: Enabled
Trigger: Manually From Actions Menu
Acts On: All documents in view
LotusScript Code:
Option Public
Sub Initialize
Dim Session As New NotesSession
Dim NabDB As NotesDatabase
Dim mailDB As NotesDatabase
Dim mailView As NotesView
Dim mailDoc As NotesDocument
Set NabDB = Session.CurrentDatabase
Set mailView = NabDB.GetView("theView")
Set mailDoc = mailView.GetFirstDocument
Set mailDb = Session.GetDatabase(mailDoc.MailServer(0),mailDoc.MailFile(0))
Dim dbsize As String
On Error Resume Next
Counter = 0
Do While Not mailDoc Is Nothing
Print Counter
Set mailDb = Session.GetDatabase(mailDoc.MailServer(0),mailDoc.MailFile(0))
mailDoc.HomeFAXPhoneNumber = mailDb.Size
success = maildoc.ComputeWithForm( False, False )
If success Then
Call maildoc.Save( True, True )
End If
Set mailDoc = mailView.GetNextDocument(mailDoc)
Counter = Counter +1
Loop
End Sub
Subject: Speed up this agent…reasonably possible or not?
-
I would use a NotesViewEntryCollection instead of looping through the view.
-
Do you absolutely need to re-compute the document? You will probably save a lot of time by eliminating that line (if you can).
Hope this helps.
Subject: RE: Speed up this agent…reasonably possible or not?
I will try both of those suggestions.
Thank you!
Subject: Speed up this agent…reasonably possible or not?
Would it be quicker to do a view lookup on the Catalog.nsf rather than to touch each mail file to find the size?
Subject: A couple of questions
Do you really have 13000 mail files to do this to? It will take quite a while.
Why do you do the ComputeWithForm? That will add a ton of time for no good reason.
Why are you putting it in the HomeFaxPhoneNumber field? Why not put it on a field that isn’t even in the form?
Subject: RE: A couple of questions
We actually have about 4 times that many of mail files, but for this exercise just 13K of them need to be queried.
ComputeWithForm was just used for best practices for Person Documents, I heard that using that will allow for indexing to be more accurate.
And as far as HomeFaxPhoneNumber well…I was just hestitant about adding another field to a person document. Will adding another field (assuming I give it a unique name that Domino wouldn’t likely complain about) be a problem?
Subject: RE: A couple of questions
ComputeWithForm should not be necessary, and adding a new field that Domino never uses is definitely not a problem.
Subject: Compute with form did it THANKS!
Subject: Speed up this agent…reasonably possible or not?
Hi,
the idea with the catalog is good.
An ohter option if you really need only the size of the database to get it from the file directly instad of the Object “NotesDatabase”.
Simply use “Dir$” to loop through the mail directory and read the lenght with “FileLen()”.
This takes “no time” at all. :-))
Bye
Hynek