Hi!
I need to keep a record of all the people who accesed a specific document and count each unique one. I can put a script in the postOpen that adds the session’s username to a field. My problem is that many people access these documents at the same time so I want to make sure that there is no saving issues… Waht can I do to verify that the document is not being saved at the time the person opens the document and who can I tell that it is ok to save the addition of his name to the document?
Thanks! Bryce.
Subject: Help! Need a solution fast!
Basically, you can’t - that’s why Notes is so great, it has all the in-built protection of Versioning.
You should think “outside the box”. Keep a record of your visitors in a different document (maybe a different database). Then you can queue up the list of visits without affecting what they are doing.
Subject: RE: Help! Need a solution fast!
Thanks for the advice! I’m still wondering if saving will be a problem? seeing as these documents are sent to about 1000 users at once and are usually opened on reception of the e-mail or other means of transmition. The reason for this request is so the creator of the document can have an idea of how many people actually read the document so they know whether to resend it or not… Thanks again for the help… Bryce
Subject: RE: Help! Need a solution fast!
The two other suggestions you got follow my logic - creaing multiple documents recording each visit, and then collating the results via a view is simple.
Subject: Help! Need a solution fast!
I did something similar by : using PostOpen (Database Script), anytime user opens to view a document, I record all the pertinent fields to a form then save it. That way, I can have views to sort by date, by user, by document hit …
Hope that helps.
Subject: Help! Need a solution fast!
-
Use the Lotus connectors in the form’s PostOpen event. If the person opening the document is not the document’s author then append a row to a SQL Server table. Values: Database replica id, document unid, user’s name, datetime. 2. Put an agent in your database to poll that table every few hours, creating response documents as needed to show who read the document and when.
-
Embed the responses in a embedded view visible to the document’s author. Use document unid as single-category value. When the author opens the document he/she will see a list of who has opened it to date. No save conflicts.
Subject: First off, I would suggest that you NOT record reads inside the document itself.
I would use a secondary smaller document for this. Try something like this:Sub RecordRead(doc As NotesDocument)
Dim ldoc As NotesDocument
Dim lv As NotesView
Dim db As NotesDatabase
Dim i1 As NotesItem
Dim s As New NotesSession
Set db = s.CurrentDatabase
Set lv = db.GetView("(ReadRecords)")
uid = doc.UniversalID
Set ldoc = lv.GetDocumentByKey(uid, True)
If ldoc Is Nothing Then
Set ldoc = db.CreateDocument
ldoc.Form = "ReadRecord"
ldoc.ReadID = uid
Set i1 = ldoc.ReplaceItemValue("Authors", "*")
i1.IsAuthors = True
ldoc.ReaderList = s.EffectiveUserName
Call ldoc.Save(True, True)
Else
If ArrayGetIndex(ldoc.ReaderList, s.EffectiveUserName) <> Null Then Exit Sub
For i = 1 to 100
ldoc.ReaderList = ArrayAppend(ldoc.ReaderList, s.EffectiveUserName)
If ldoc.Save(False, False) Then Exit Sub
set ldoc = Nothing
Set ldoc = lv.GetDocumentByKey(uid, True)
Next
End If
End Sub