View control: how to process selected documents?

I need to process all selected documents from a view control on an xPage.

Is there something to get that collection of selected documents?

Thanks

Diego

Subject: viewPanel.getSelectedIds()

Hi Diego,

This is from the wiki:

var viewPanel=getComponent(“viewPanel1”); //get the componet of viewPanel

var docIDArray=viewPanel.getSelectedIds(); //get the array of document ids

for(i=0;

i < docIDArray.length;

i++){

var docId=docIDArray[i];

var doc=database.getDocumentByID(docId);

…// your code to deal with the selected document

}

You can read the article here: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/2008-11-11033022WEBBZ4.htm

-John

Subject: set field

I am doing the same thing…

hoping to set a field “approved” to the value “Yes”.

Suggestions?

Subject: an example of setting a field value

Here I set a field (approved) to a value:

var viewPanel=getComponent(“viewPanel1”); //get the componet of viewPanel

var docIDArray=viewPanel.getSelectedIds(); //get the array of document ids

for(i=0;i < docIDArray.length;i++){

var docId=docIDArray[i];

var doc=database.getDocumentByID(docId);

doc.replaceItemValue(“approved”,“yes”);

doc.save(true);

}

-John