I needed to update a parent document from a response document in a Web application, while the parent document was in edit mode. When the parent saved, I got a save conflict error. To solve my dilemma, I created the code below to set field values of the parent document. It uses the @SetDocField formula with the evaluate statement.
Dim doc as NotesDocument
Dim s as New NotesSession
Dim formula As String
Dim result as Variant
Dim fieldname as String
Dim fieldvalue as String
Set doc = session.DocumentContext
---- Do all your calculation then update
the fieldname with new fieldvalue.
formula = FormulaSetFieldValue(fieldname,
fieldvalue) result = Evaluate
(Formula, doc)
Where = FormulaSetFieldValue is a tiny function:
Function FormulaSetFieldValue(fieldname
As String, fieldvalue As String) As
String
FormulaSetFieldValue = {@SetDocField($Ref;}
& {"} & fieldname & {";}
& fieldvalue & {)} End Function
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Viet Nguye. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.
This was first published in October 2004