Strange behaviour for Unprocessed

From I view I execute an agent (clicking a button). The agent acts on “Selected documents”.

I have the folowing code:

Set db =session.CurrentDatabase

Set dcc_seleccion=db.UnprocessedDocuments

For i_contador=1 To dcc_seleccion.Count

…

'Here a mail is sent

…

Next

The strange thing is that if I select one document on the view, it works fine: the document is not visible in the view anymore and a mail is sent.

But later if I select another document … two mails are sent! … and so on!

I debugged and observed that dcc_seleccion.Count is 2, 3, 4, etc although I only selected one document!!

Hints: 1) in the middle of the loop For I open the document in uidoc, I update some values and later is close. When later new documents are selected two or more documents are open! (the loop is executed several times).

  1. Initially was an application in 4.6. After in 5.0 gave no problems. Now is in a 6.5 server. Is there something wrong in the new release with Unprocessed doc or uidocs?

Tks!

Subject: Strange behaviour for Unprocessed

Dear Pere,

Do one thing when u a process any document after that use updateprocess document method to stamp the particular document so that next time unprocessed document collection will not use that document.

Rishi

Subject: RE: Strange behaviour for Unprocessed

Hi Rishi.

I didn’t have that implementation at the beginning, but later I added and … it works the same.

I checked that when I select a document a mail is generated. Then if I select another one and lunch the agent again, a mail for the new document is document.

If I mark a third document an execute the agent, a new mail is created … but a 3rd mail from the 1st document selected and a second mail from the second document selected, as well. And so on …

I use updateprocess … but I still have the problem. Any idea?

Thanks in advance for your support!

Subject: RE: Strange behaviour for Unprocessed

Sounds like your document remains selected in between agent runs, but you can’t see this because the selected document is removed from the view during the agent.

Try using uiView.DeselectAll at the end of your agent and see if this helps.

Emily.

Subject: RE: Strange behaviour for Unprocessed

Still the same behaviour …

By the way, although I access with a Notes client 6, the server is Notes 5 … so I have an error with the Call UIView.DeselectAll .

The code is something like this:

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim correo As NotesDocument

Dim uidoc As notesuidocument

Set UIView = Workspace.currentview

Set db_db =session.CurrentDatabase

Set dcc_seleccion=db_db.UnprocessedDocuments

If dcc_seleccion.Count=0 Then

Messagebox “No documents”

Else

For i_contador=1 To dcc_seleccion.Count

   Set doc=dcc_seleccion.GetNthDocument (i_contador)

		              		

    Set correo = New NotesDocument(db_db)		correo.Form="Memo"            

Dim item As NotesRichTExtItem

Set item = New NotesRichTextItem( correo, "Body" )

Call item.AppendText(doc.Field_of_the_doc(0)) 

correo.Subject="some_text"   

	...

Dim email As String

email=getSendTo(doc,db_db)

If email<>"" Then

Call doc.Save(True,False)  

Call session.UpdateProcessedDoc( doc )

			correo.BlindCopyto=session.commonusername

Call  correo.send(True,email)			

End If

		

Set uidoc = workspace.EditDocument( True, doc )                 

Call uidoc.GotoField("E_NIF")

Call uidoc.Selectall

Call uidoc.Copy

Call uidoc.save                       

Call uidoc.Close      

Next

Call UIView.DeselectAll

Call Workspace.viewrefresh

End if

any idea?

Subject: RE: Strange behaviour for Unprocessed

Hi! Any other idea why this is happening and how to solve it? I’m getting crazy!! :frowning: