Selecting and processing multiple documents in a view via the web

Hi, I have searched far and wide trying to get this to work, but before I give up I thought I’d try here…

The documentation clearly states that multiple documents in a view can be selected via the web, and that view actions can be written to process the selected documents.

The examples I have seen all refer to using db.UnprocessedDocuments to get access to the collection of selected documents, but my test action always operates on all documents in the view, regardless of which are ticked in the view selection margin.

This happens regardless of whether the lotusscript is directly in the view action, or if the view action calls a separate agent via ToolsRunMacro.

It also seems to be independant of whether the view is presented directly to web or embedded in a page.

I’m also seeing strange behaviour in relation to the view Action Bar, which refuses to appear under various circumstances, especially if the view is embedded.

Any pointers at all would be appreciated.

Dennis

Subject: Selecting and processing multiple documents in a view via the web

Hi Dennis,

First you should add column with checkbox selector to your view. I prefer to do this in manual way in place of Allow selection of documents propertie.

Your column should be in HTML format (if you don’t use Treat view contents as HTML propertie):

{}

Now, you need prepare form for view preview. View should be embedded into the form. Create computed for display text item on your form called MySelector with value MySelector. Allow multiple items for this item.

Add some action to the form that will call agent GetSelectedDocuments. Trigerred on Event, Action menu selection, Target None:

@Command([ToolsRunMacro];“GetSelectedDocuments”)

When you click the action button, selected values will be automatically calculated into MySelector computed fields.

Last thing that should to do is to get this values by your GetSelectedDocuments agent:

Dim session As New NotesSession

Dim db As NotesDatabase

Dim docCurrent As NotesDocument

Dim doc As NotesDocument



On Error 4091 Resume Next ' invalid universal ID



Set db = session.CurrentDatabase	

Set docCurrent = session.DocumentContext

' for all selected documents

Forall i In docCurrent.MySelector

	' get selected document by unid

	Set doc = db.GetDocumentByUNID(i)

	If Not doc Is Nothing Then

		' < your code comes here >

	End If		

End Forall

That’s it :slight_smile:

Hope I missed nothing…

Best Regards,

Dima Pechersky