Hi everybody,
I got a trouble with the Reload method from NotesUIDocument. Look the help, it says about Reload:
"Refreshes the current document with any changes that have been made to the corresponding back-end document. "
In this code:
…
set uidoc = ws.currentdocument
set doc = uidoc.document
…
doc.field_1 = “Hi”
doc.field_2 = “Hey”
…
’ Saving the changes do it in code
doc.save true, false
’ “Reload” the changes made in back-end to the front-end
uidoc.reload
’ Save the front-end, to don’t see the message “Do you want to save your changes?”
uidoc.save
It don’t cares if I use uidoc.save or if I press “Yes” in the dialog “to save ypur changes”. In both cases, the changes made through code they losses, disappear, don´t saves.
What can I do?? i don’t believe that will be a bug… but I’m tired to try and moves lines of code.
TIA,
Mario
PD. While I’m debugging, the changes losses just after the uidoc.save. If I don’t use uidoc.save, the changes will lossing when I press “yes” in the dialog “to save ypur changes”
Subject: Reload don’t works!
Form reload works perfectly in the following scenario. I am not sure how you handle the form query save event. Here is the simple way to test the reload method.
I have created two fields in a form called user1 & user2. i have a saveoptions=“0” as default. Onclick of a button
Dim uw As New NotesUIWorkspace
Dim ui As NotesUIDocument
Dim ss As New NotesSession
Dim doc As NotesDocument
Set ui = uw.CurrentDocument
’ Call ui.Save()
Set doc = ui.Document
doc.user1="Wish you good luck"
doc.user2="GoodLuck"
doc.saveoptions="1"
Call doc.Save(True,False)
Call ui.FieldSetText("saveOptions","0")
Call ui.save
Call ui.Reload
Subject: Reload don’t works!
Might it be that Field1 / Field2 are rich text ? In that case reload won’t do a thing for you.
There might be a misunderstanding about what reload does for you. This is how I understand Notes…(not implying that this is gospel, but it seems to match my experience.)
There are 3 documents involved here. DISK, MEMORY and SCREEN.
DISK is the document that’s saved in the database.
MEMORY is the copy that Notes is working on, and we access these through NotesDocument.
SCREEN is what the user sees, and we access this though NotesUIDocument.
For non-Rich Text fields, the values in MEMORY and SCREEN are always kept in sync. Change a field in either, and the other is updated.
Rich Text is different. Saving the uidoc will over-write any changes that you might have made to the doc fields, so never try to update a RTF while the uidoc is open in edit mode.
So in the code you had, when you updated doc (the memory version) you don’t need the reload to update the uidoc - that’s automatic.
The Reload function is used when some other process or user updates the DISK version of the document, and you want to reload those changes into your MEMORY / SCREEN copies.
Subject: Reload don’t works!
did you try using doc.ComputeWithForm?