Modify value from a view

Hi,I’m looking for a code to read and to write values in a document, directly from a selected document in a view trought a Button function.

I tried with the following Agent-code using notesuiview class:


Dim session As New NotesSession

Dim db As NotesDatabase

Dim workspace As New NotesUIWorkspace

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Dim uiview As NotesUIView

Set db = session.CurrentDatabase

Set uiview = workspace.CurrentView

Set collection = db.AllDocuments

Set doc = collection.GetFirstDocument

myFld = doc.MyField(0)

messagebox myFld

doc.montaggio_txtStatoDoc = “read”

Call doc.Save(True,False)


but I’ve a empty value. MyFld variable is empty and the field havn’t been modified.

Someone can help me ??

Thank you :wink:

Subject: Modify value from a view

Use “db.UnprocessedDocuments” to get collection of documents selected in a view and process them! All documents will return all the documents in a database.


Dim session As New NotesSession

Dim db As NotesDatabase

'Dim workspace As New NotesUIWorkspace

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

'Dim uiview As NotesUIView

Set db = session.CurrentDatabase

'Set uiview = workspace.CurrentView

Set collection = db.UnprocessedDocuments

Set doc = collection.GetFirstDocument

While Not doc is nothing

myFld = doc.MyField(0)

messagebox myFld

doc.montaggio_txtStatoDoc = “read”

Call doc.Save(True,False)

set doc = collection.getNextDocument(doc)

Wend

Hope this helps!

Thanks,

Bruno!

Subject: RE: Modify value from a view

Thank you very much!!!It’s ok!!