Hi, I need help with this problem.
Lets imagine the situation:
there is a document with field “MyField” and its value “Value”. An user opens the doc and changes “MyField” value to “NewValue”. Then the user wants to save the doc. And before the doc is saved I need to get both values in Lotus script (“Value”, “NewValue”).
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
’ now i have set uidoc and there is no problem to get the “Newvalue” by FieldGetText method
Dim doc As NotesDocument
’ and now i dont know how to set the document. it is the document that was opened before editing (“MyField” has a value “Value”)
please can u help me with that. thank you very much
pp
Subject: How to set doc by current document?
for example…declare in form declaration
dim thisUIDoc as notesuidocument
dim oldValue as string
sets in form postopen
set thisUIDoc = source
’ save ol value
oldValue = cstr(thisUIDoc.Document.getitemvalue(“YouField”)(0))
… user make change
…you code
dim newValue as string
newValue = thisUIDoc.fieldGetText(“YouField”)
msgbox oldValue + “=” + newValue
Subject: How to set doc by current document?
Dear Petr ,Try to capture old value in some hidden field . On the form load you can set this value and check if they both are same then ignore if diffrent values then do what ever you want to do.
Hope you got it.
Mike
Subject: RE: How to set doc by current document?
thank you all for your replies.i have done it thanks to postopen action.
so thanks and have a nice day
Subject: How to set doc by current document?
Hi
Its quite simple - all you need to do is use a global variable.
In the onLoad event (onLoad can be used for Lotusscript - in fact it is the preferred event) just get the value of the Myfield value in the variable.
So if the user saves another value in the field - you will still have the old value of the field in your global var and the new value from the field itself.
HTH
A
Subject: How to set doc by current document?
hi petr,
dim doc as notesdocument
// set document by this
set doc=uidoc.Document
//change value by using “doc”
if that didn`t work then plsreply
bye