Hi,I’m creating a small database, where my boss likes to enter a note, presses a button and informs two other bosses about it. Easy. The trick is, that he likes to enter a due-date and if one of the others hasn’t read that by that time, likes to remind him automatically. As I don’t want to use hardcoded names (tomorrow he says, oh lets add someone else to inform) I have a profile doc, where I enter the names of the user which can be informed. From this I generate a checkbox-field on my info-form, where I read the profile-field. I have a script in “postopen” which checks if the user has read this documents already, and if not, adds name and date into a field.
What I don’t find now is, how to check who has read and who hasn’t. MAybe one user has read, the other hasn’t. Maybe I’m on the complete wrong track with my idea, but at the moment I’m stuck. Any ideas out there how to handle that.
This should replace all names from AlreadyRead who are in the readers list with “” then the trim function will get rid of the empty strings. This should return a list of all who are in the readers list but are not in the already read list.
Field1 - List of all the authors who needs to read the document.
Field2 - Temporary field. This field contains the same values as of Field1 above but will be modified by the below LS code.
When the user opens a document for reading then write code in PostOpen event to check whether the currently logged in user is in the list or not, and if present remove him from the list.
I prefer Lotus Script to do this.
Here is the sample LS code -
Sub Postopen(Source As Notesuidocument)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim item As NotesItem
Dim dummyarray() As String
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
temp = "a" 'get the currently logged in user name here
Set item = doc.GetFirstItem("te") 'change the field name here to Field name #2 above
If item.Contains(te) Then 'if the user name is present in the list then only remove it
Set dummyitem = New NotesItem(doc,"dummy","")
i=0
Forall v In item.Values
If v <> temp Then
Redim Preserve dummyarray(i)
dummyarray(i) = v
i=i+1
End If
End Forall
item.Remove
Set item = New NotesItem(doc,"te",dummyarray) 'Change "te" to the Field name # 2 above.
End If
doc.Save True,False 'Check whether this is the appropriate location of saving the document
End Sub
So, by this you have the list of all the readers who needs to read the document (Field #1) and then list of readers who still needs to read the document (Field #2). Field #2 will be updated by LS code accordingly.
Alternatively, try for @subset function to achieve this.