Hi,(I’m new in this forum so - hello everybody
)
I have such a problem - with a document flow working as follows:
-
there is a view with docs (docs of activities in this documents flow) being edited in the preview pane
-
in the preview pane I don’t explicitly edit the doc but I use a button to perform something, especially to change some status field and to change the readers / editors of this doc (I have top privileges so I can still see this doc); this way, it is at least second version of this document (first - just created, second - after status changing)
-
next, I manually select an agent which finds this doc (obtains a collection of all documents to be processed), closes this activity (changes its status and saves it) and creates the next activity (depending of the process definition)
If the database is on the server it works fine.
If it is on the local machine and the activity doc, which is to be processed, is the current one (selected and displayed in the preview pane) - it works fine.
But if the db is on the local machine and the doc is not the current one, in the collection I get… the first version of the document, with old data. And I can’t save it, of course.
Closing the database is not enough. I must close and open the Lotus Client to process this document properly.
I’ve got some other similar cases in other databases, so this problem is not related with only this one db.
And - rarely but sometimes it works…
Have you got any suggestions?
This problem occurs also in 6.5.2 and 7 Beta 3 realeases. Both on WinXP i Win2000 platforms.
Subject: NotesDocumentCollection gets old versions of documents
Sounds like the backend view is not being updated. The local machine may not be updating the view quickly enough, whereas on the server is automatic. check out the notesUIWorkspace.ViewRefresh method. Details from the help are;
Usage
If a view is in the active window, this method refreshes that view.
If a document is in the active window, this method refreshes the view associated with the document when the view’s window is activated.
This method first refreshes the associated back-end view unless the code containing the method is running in a UI document. To refresh a UI view from within a document, first call Refresh of NotesView.
Subject: RE: NotesDocumentCollection gets old versions of documents
No, it is not an issue. The script was:
Dim view As NotesView
Dim strKeys() As String
Dim dcRef As NotesDocumentCollection
Set view =
view.Refresh
Set dcRef = view.GetAllDocumentsByKey(strKeys, True)
I added declaration and refreshing:
Dim ws As New NotesUIWorkspace
Dim view As NotesView
Dim strKeys() As String
Dim dcRef As NotesDocumentCollection
Set view =
ws.ViewRefresh
view.Refresh
Set dcRef = view.GetAllDocumentsByKey(strKeys, True)
but it didn’t help.
Subject: RE: NotesDocumentCollection gets old versions of documents
I think your problem has to do with the LotusScript internal cache of documents held in memory. When you process a document with code, you should use the Delete statement to clear it from cache.
Subject: RE: NotesDocumentCollection gets old versions of documents
I think it is something different:- why it works on server?
- I select this doc, read the collection - the doc is the current one; I select another - I get an older version; I select this - current version; I select another - an older version; and so on; 2 different caches?
Subject: RE: NotesDocumentCollection gets old versions of documents
I don’t know – might be chance, or based on what other scripts you run locally as opposed to on the server.
- I select this doc, read the collection - the doc is the current one; I select another - I get an older version; I select this - current version; I select another - an older version; and so on; 2 different caches?
No, one cache, but the cache only contains the documents you have previously accessed in script. I’m saying that the problem might not be in the script you’re seeing the error in, but in some other script that processed some of the documents previously – but not others – and failed to clear them from the cache when it was done.
Subject: RE: NotesDocumentCollection gets old versions of documents
Yes, you are right. I’ve added deleting docs objects and it works.Thanks.