Solved

Checking if Document has been previously modified before saving!!

Posted on 2001-08-30
4
175 Views
Last Modified: 2013-12-18
Hello all

On clicking an 'Approve' button, I'm attempting to check whether the document has already been approved since I opened it and if so, I want to display a message and stop anything else happening.

This is the function I am using to check it.  It's called before anything else happens:-

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

Function CheckStatusChanged(uidoc As NotesUIdocument) As String
     Dim s As New NotesSession
     Dim ws As New NotesUIWorkspace
     Dim doc As NotesDocument, Doc2 As NotesDocument
     Dim db As NotesDatabase
     
     Dim sDocToFind As String
     Dim dc As NotesDocumentCollection
     Dim x As Integer
     
     Set doc = uidoc.Document
     Set db = s.CurrentDatabase
     
     sDocToFind = doc.NoteID
     Set doc2 = db.GetDocumentByID(sDocToFind)
     
     Msgbox "Saved Status: " & doc2.rStatus(0) & Chr$(13) & "Current Status: " & doc.rStatus(0)
     If Not doc2.rStatus(0) = doc.rStatus(0) Then
          CheckStatusChanged = "Yes"    
          Exit Function
     End If    
     CheckStatusChanged = "No"
End Function

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

I open the document, someone else opens and approves the same document then when I approve it, it doesn't pick up the fact that the status has changed!!

Anybody got any ideas please?

Thanks in advance

Ian

PS If anyone has problems accessing ExpertsExchange.com at work (like I have for months), use Experts-Exchange.com instead as I guess the hypen stops the word 'sex' being created in the middle!!!
0
Comment
Question by:IanWood
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
martijnmulder earned 100 total points
Comment Utility
I guess the only thing you really can do is (and this only works when the application only exists on 1 server) create another document (approval document) and look for the existence of that document on approval. e.g. store the document unique id of the original document in the approval document and make that the key in the first column of a view ?

it's a bit more complicated but it should work.

The other option is on approval to close the document and re-open it but that would cause flashing screens....
0
 

Author Comment

by:IanWood
Comment Utility
Cheers, out of curiousity, if I haven't saved the new document, and I get a new handle on it why doesn't it pick up the later saved version?

0
 
LVL 4

Expert Comment

by:martijnmulder
Comment Utility
well the document goes from the disc (or nsf) into memory the moment you open it. It does not refresh itself (in memory from disc) until the next time you open it. That's why you get save conflicts when you try to save the same document at the same time.

When you get a new 'handle' on the document you only get a new pointer to the same memory address. This does not update until you close the document.
0
 

Author Comment

by:IanWood
Comment Utility
Cheers!! I think the approval document sounds like the way to go, as that way I can track all approvals on it..


0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now