List of persons entered into a form from all documents

I have database with a form for specific items containing fields where I enter specific names of persons from different areas (i.e. each field stands for a specific area).1 person can be in different forms.

Now my problem: I would like to have a list of all persons enterend into the form (in all documents), because I need to set up a ACL group for them.

Is there a way to do this?

Any help is very appreciated

Leini

Subject: Thank you!

I will test your solutions, which are, as I understand, very elaborated.Having an agent scanning the documents is a helpful feature (like Andre proposed) and to set an acl entry as a group is also great (like Matt proposed). I am quite new to such elaborated ideas, but I intend to get to this level one time.

In the meantime I found an ‘integrated’ solution:

I set up a view with a column @trim( all names fields…) multiple values separated. Then I exported it to Excel (nice feature from the Sandbox) and ‘counted’ the elements via a Pivot table. This way, I got a list of all names, one name per line (without doubles…).

But this is emergency solution compared to your proposals.

Thank you very much for your help,

Leini

Subject: RE: list of persons entered into a form from all documents

You have some documents each of which contains multiple Names fields. You want to collect all the names that are in any of the fields in any of the documents into a single list so that you can create a group out of them.

You could create your list in memory using @DbColumn if you have a view that lists all these documents categorized by the fields. E.g. suppose the fields are Name1 thru Name4, then your view column formula might be:

@Trim(Name1 : Name2 : Name3 : Name4)

I’m assuming this is going to be a short list, so that the limitation of @DbColumn to return no more than 64K of data will not be a problem. What you do with the list once you’ve gotten it into a variable is a different story.

If not, or if you just prefer to do it this way, you can use LotusScript to scan the documents. So let’s say you create an agent that will scan the documents and update your group. To do the group member updates you could use the NotesGroup and NotesGroupManager classes located here: IBM Developer (see the “sample code” link on the right).

Using this you could write an agent that executes on all documents. Use selection criteria to limit it to documents that use the one form.

Dim gman As New NotesGroupManager(True)

gman.LoadPublicAddressBooks

Dim group As NotesGroup

Set group = gman.GetGroup("name")

If group Is Nothing Then

	Set group = gman.CreateGroup("name", GROUP_TYPE_ACL, 0)

Else	' remove all existing members of the group.

	Forall subgroup In group.BreakoutSubgroups

		Call subgroup.Remove

	End Forall

	group.Members = ""

End If



Dim coll As NotesDocumentCollection

Dim doc As NotesDocument, docNext As NotesDocument

Dim intInd As Integer

Dim fldval As Variant

Set coll = db.UnprocessedDocuments

Set doc = coll.GetFirstDocument

Do Until doc Is Nothing

	For intInd = 1 To 4 ' or whatever

		fldVal = doc.GetItemValue("Name" & intInd)

		If fldval(0) <> "" Then Call group.AddMembers(fldval, GROUP_RECURSE)

	Next

	Set docNext = coll.GetNextDocument

	Delete doc

	Set doc = docNext

Loop

Call group.Save(GROUP_RECURSE)

The code is a little simpler if you assume the group is small enough to fit in one Group document rather than a hierarchy of documents, but I didn’t want to assume that.

Subject: list of persons entered into a form from all documents

Leini

If you look at the NotesACLEntry Class (in the help file) there is a property to set an acl entry as a group (.IsGroup).

I have created an acl entry using the example code below:

Set acl = newdb.ACL

Set entry = New NotesACLEntry(acl,NAME of group/person, ACLLEVEL_EDITOR)

entry.UserType = 1

Call acl.Save

hope this helps.

Matt