Good Morning! Everyone,
I had a problem with my agent. I wrote an agent to run against a view. I dim a counter as integer, but there are too many documents in my view, so I got message said it is overflow and the agent stopped, but the agent has already updated a certain number of documents. My question is:
How I can change my agent only update the rest of document in this view. Any help, I will appreciate.
Subject: LS question
Is there a way to examine a document and see if it has been “updated”. If so, change your counter to a Long, and just check each document before updating to see if it has already been processed. If not, you may have to look at the last modified date and whether it was done by you and that sort of thing.
Subject: LS question
Thanks everybody. I got idea about it.
Subject: LS question
i’m just curious, how many documents is in your view?how do you loop through them? and how do you access it…try giving a bit more details, or even better post the code.
Subject: RE: LS question
Thanks, Robert.
This database is a big database. It is more complex than Lotus Notes DB capability. There are about 120,000 documents. My code likes the following:
Set view = db.GetView(“($viewname)”)
Set doc = view.GetFirstDocument()
While Not(doc Is Nothing)
…//update the field
cnt++
Set doc = view.GetNextDocument(doc)
endw
It run more than two hours yesterday, then get the overflow message. It means it has already processed 32767 documents.
Thank you very much!
Subject: RE: LS question
Jeff,
There is your answer then (as long as new docs have not been created
Set a seperate counter (eg: alreadydone#)
While Not(doc is Nothing)
alreadydone#=alreadydone#+1
if alreadydone>32767 then
'update document
End If
Mike
Subject: RE: LS question
seems to me that it’s using a 16 bit pointer limitation and it has been reached so you need to find a workaround. i have a feeling the Set doc = view.GetNextDocument(doc)
will only go up to 32767.
as mike j poole wrote, try having a separate counter to do your work in sequence.
or you can also try to segment your documents by categorizing them;
try creating a sorted view, then maybe you can find a pattern that will let you segment your code or documents
Subject: LS question
Jeff,
Could you look at the last modified date of the document, or will users have amended documents subsequently that the agent missed??
Did your agent update a specific field that you could interrogate??
Mike
Subject: RE: LS question
Could you have as part of your view formula something that would remove the processed documents out of the view and use GetFirstDocument each time?
For example the view would exclude any docs whose field “Processed” = “1” and your script would set “Processed” to “1” (thus removing it from the view).