Manage Learn to apply best practices and optimize your operations.

Know document changes since last save

If you need to know if a document was changed since the last save you can use the following code.

View member feedback to this tip.

If you need to know if a document was changed since the last save you can use the following code instead of using the undocumented NotesUIDocument.ModifiedSinceSaved(which doesn't work with R6.5).

  
  In global declartion
Dim Modified As Variant 


Sub Postopen(Source As 
Notesuidocument)
 Set uidoc = source
 Set doc = source.document
 Modified = Evaluate(|@Modified|,doc)
End Sub


Sub Queryclose(Source As 
Notesuidocument, Continue As Variant)
 Dim tmp As Variant 
 tmp =  Evaluate(|@Modified|,doc) 
 If Modified(0) <> tmp(0) Then 
  msgbox "The document modified 
since last save"
 End If
End Sub

MEMBER FEEDBACK TO THIS TIP

Interestingly, if you read the Domino Designer 6.5.1 Help concerning @Modified (which is the core of this tip), you'll find that it returns unexpected results unless used in a view's column formula. While I suspect that the logic behind this tip is probably good, I'm a little reluctant to trust the way that @Modified is being used here.

For instance, the help document states that, "@Modified works correctly only in column formulas. When used in computed field or computed-for-display formulas, @Modified returns a value representing the next-to-last time the document was saved." If that's the case, what will @Modified return the very first time it's called after a document is saved. Will it return the last save, or will it return nothing (or even an error) since there is no next-to-last time the document was saved.

Also, in that same help document, I noticed a cross reference to the LotusScript NotesDocument class's LastModified property. Is there any reason that this property wouldn't provide exactly them same functionality without having to rely on an evaluated @Formula that's being used in a way that the Notes documentation states may cause problems?

—Keil W.

******************************************

I agree that using the LastModified property will simplify the use of this tip. But the important issue was the idea to track this property in the postopen and queryclose events.

—Yossi Sabag, tip author

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Yossi Sabag. 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.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close