db.UnprocessedDocuments doesn't work in embedded view

Hi,I’m using a form containing an embedded view. The view shows only document from one category. In an view action I’m trying to get a notes document collection of the selected documents via db.UnprocessedDocuments. The document selection contains 0 documents.

Here is the view actions code:

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim dc As NotesDocumentCollection	

Dim doc As NotesDocumen



Set db = session.CurrentDatabase

Set dc = db.UnprocessedDocuments



print dc.Count	

End Sub

Any help is much appreciated.

Cheers

Stefan

Subject: db.UnprocessedDocuments doesn’t work in embedded view

I ran into the same problem. I’m sure someone already mentioned this, but the problem is due to your action button not being on the embedded view itself. There is actually a really good way around this if you don’t want to put the button on the embedded view. You can you use the Onselect event of the embedded view and write to a trusty profile document. Then, you can access that profile document no matter where you are. I did this and it works beautifully. Here’s an example of the code I put on the Onselect event:

Dim s As New NotesSession

Dim db As NotesDatabase

Dim col As NotesDocumentCollection

Dim docProf As NotesDocument, docMember As otesDocument

Dim item As NotesItem

Set db = s.CurrentDatabase

Set docProf = db.GetProfileDocument(“profDoc”,s.UserName)

Set col = source.Documents

docProf.names = “”

Set item = profDoc.GetFirstItem(“names”)

Set docMember = col.GetFirstDocument

While Not docMember Is Nothing

Call item.AppendToTextList(docMember.Who(0))

Set docMember = col.GetNextDocument(docMember)

Wend



Call profDoc.Save(True,False)

Let me know if you need me to clarify or expand upon any of that.

Subject: db.UnprocessedDocuments doesn’t work in embedded view

Why do you show the code in Initialize? Should be in Click.

Given there is a typo (NotesDocumen) I’m guessing you just made a mistake.

I just tried it and it worked fine IF the action button is on the embedded view:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim dc As NotesDocumentCollection	



Set db = session.CurrentDatabase

Set dc = db.UnprocessedDocuments



Msgbox "[" + Cstr(dc.Count) + "]. The end."

End Sub

Subject: db.UnprocessedDocuments doesn’t work in embedded view

Is the action in the actual view?

If it is in the form then it will not work as it can’t get a handle on the embedded view.

Subject: RE: db.UnprocessedDocuments doesn’t work in embedded view

Thanks for the reply.

I’ve got it. The action is a view action but it call an agent which contains the posted script. The UnprocessedDocuments are available from within the view action but not from within an agent called by the formula-view-action.

It works if I copy the agent-code to the action.

Subject: RE: db.UnprocessedDocuments doesn’t work in embedded view

The agent should still be able to use UnprocessedDocuments provided you have set it to run on “selected documents”.

Or, since the focus is still in the view as the agent runs, you should be able to use an agent with NotesUIView.Documents property, to locate the selected documents.

Subject: RE: db.UnprocessedDocuments doesn’t work in embedded view

Hmmm, what Matt posted here

http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/f90e6f52d70d4eb18525740b0058e77d?OpenDocument

should still apply, I think …