Check if someone has read a document

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.

Thanks

Oliver

Subject: check if someone has read a document

A view with 4 columns. 1)column for Doc name

2)Column with all names in reader field

3)Column with all names and dates in AlreadyRead field

4)Column showing all readers names that are not found in AlreadyRead field. Simple @Contains should do.

Subject: RE: check if someone has read a document

Thanks,I got the idea. Problem is column 4. With @contains I get only 1 or 0 as result.

Lets say column 2 shows readers “Joe Smith, Jack Johns”

column 3 shows Already read “Jack Johns 28.12.2006”

how do I get “Joe Smith” in the 4 Column?

Thanks

Oliver

Subject: RE: check if someone has read a document

Thanks for your ideas,I will test both and see what fits best for me.

Oliver

Subject: RE: check if someone has read a document

Try something like…

@Trim(@Replace(AlreadyRead; readers_field; “”))

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.

Hope this helps

Pete

Subject: RE: check if someone has read a document

As Rooste, suggested first create 2 fields -

  1. Field1 - List of all the authors who needs to read the document.

  2. 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.

–Phani