Hai all
I want to determine, whether a document was edited or not by an user ?. Let us consider a document. now if i open the document and edited any of the field's present in the form that was used to create the document, and if i hit esc key, then notes will prompt with a dialog asking whether to save the changes that were done or not ?
I need to know how notes keep track’s that a value was modified and how notes prompts the dialog box asking to save the changes or not ?
Does note’s maintains any flag to track the changes that were done in the document ? if yes then what is that flag or the reserved field if it has one ?
if there is any reserved field or some flag, then can i access the field value ?
I have a situation currently in which i need to determine whether any field values are changed in a document. The user need not to save the document. On editing the document and without saving the changes i need to know that the document was edited.
Anybody please guide me on this. please tell me how notes is achieving this functionality.
Help much appreciated on this.
Thanks & Regards
JV
Subject: how to determine that a document was edited ?
Here’s an example:
create a Times_Mod computed field and use this formula -
@If(@IsUnavailable(Times_Mod); -1; Times_Mod + @IsDocBeingSaved)
create a Past_Author computed field and use this formula -
@If(@IsDocBeingSaved; @If(Times_Mod <= 0; @V3UserName; Past_Authors : @V3UserName); Past_Authors)
create a Past_Edit computed field and use this formula -
@If(@IsDocBeingSaved; @If(Times_Mod <= 0; @Text(@Now); Past_Edit : @Text(@Now)); Past_Edit)
I put the fields at the bottom of the form in a 3 column table.
Times Modified - Past Authors - Past Edits
Subject: RE: how to determine that a document was edited ?
Hi Michael
I tried using your tip, but iam getting the error :
ERROR: Incorrect data type for operator or @Function: Text expected
for all the three fields. Also can you tell me how this thing will work. Please note that i want to determine whether any field was edited without saving the document.
many thanks
JV
Subject: RE: how to determine that a document was edited ?
oops, the code I sent you is for the web…
here’s the correct code
time modified field - anumber field
@V2If(@IsUnavailable(Times_Mod); -1; Times_Mod + @IsDocBeingSaved)
past authors field - text
@V2If(@IsDocBeingSaved; @V2If(Times_Mod <= 0; @V3UserName; Past_Authors : @V3UserName); Past_Authors)
past edit field - date/time
@V2If(@IsDocBeingSaved; @V2If(Times_Mod <= 0; @Now; Past_Edit : @Now); Past_Edit)
I’m sure I don’t understand…but if the document is edited and not saved, what difference does it make…the edits ARE NOT SAVED!!!
Subject: how to determine that a document was edited ?
If the user doesn’t save his own edits, any flags you put on the document to indicate whether fields were changed but not saved won’t be saved, either. You would need to build a separate edit history, which gets a little complicated.
Notes doesn’t keep track of previous field values, so you would have to capture them in PostOpen and compare them in QueryClose to see exactly what changed.
@IsDocBeingSaved fires when the document is being saved, and there is is also @ModifiedSinceSaved or something like that with a corresponding NotesUIDocument property
Subject: RE: how to determine that a document was edited ?
But how does the “Save Options” work. I include a “Save Options” field in the form, when i edit something and without saving when i close the form notes prompts “Do you wish to save”. If we don’t have any flags to track the edit done by an user then how does it work for “Save Options”?
Subject: RE: how to determine that a document was edited ?
saveoptions is used to save or NOT save the form…what are you wanting the save option to do?
Subject: RE: how to determine that a document was edited ?
Hi Michael
Can you tell me whats behind the Lotus Notes Save dialog prompt ?. I think you have noticed most of the times, if you edit a document and hit the ESC key without saving the edits by using CTRL+S or some other way, then Notes prompts a message box asking whether to save the changes ?
So now tell me whats behind the message box and what is it causing notes to prompt the message box when you edit a document and hit the ESC key without saving the edits ?
I believe that notes uses some kind of tracking mechanism to achieve the functioanality ?. Iam wondering what could be it ?
Please drop your suggesstions on this…
Many thanks
JV
Subject: RE: how to determine that a document was edited ?
How are you doing the filesave, close window?
Try this to stop the message prompt -
@If(@Command([FileSave]);
@Command([FileCloseWindow]);“”);
The prompt comes from FileCloseWindow - look at the HELP
Closes the current Notes window. If the document or design element in that window has not been saved, Notes prompts the user to save it before closing.
Subject: RE: how to determine that a document was edited ?
Michael
Thanks for your suggestion. anyway i will try to find a workaround for this.
Cheers
JV
Subject: RE: how to determine that a document was edited ?
Hi Charles
Iam asking the same question which i have been asking to Michael, What causes Notes to prompt the message box asking whether to save the changes ? if you edit a document and hit the ESC key without saving the edits.
So what is exactly happening behind the scenes ? and how notes knows that the document was edited ?
It makes sense that the thing you have mentioned like @ModifiedSinceSaved , relates to my question.
Iam wondering that does notes has any reserved fields that keeps tracks that a document was edited and is saved or not ?
Please drop your suggestions on this charles.
Many thanks
JV
Subject: RE: how to determine that a document was edited ?
Note’s knows internally if an open document has been modified, and so should prompt the user to save on closing.
This is NOT don’t through any field on the document, and so cannot be checked using formulas or script (to the best of my knowledge)
Subject: how to determine that a document was edited ?
I am not sure if this can be done, even with the R6 undocumented ModifiedSinceSaved NotesUIDocument property and its cousin @ModifiedSinceSaved formula language function.
It seems that those flags only indicate a valid status when in the document saving process (QuerySave event for example) and do not seem to accurate reflect the actual status in the QueryClose event.