Notes Collection on Values in Field

Hi all,

I have a Field which will have a list of names.

I want to get the first name and get the servername & mailfile for this name.

Run some code using these values. Then get the next name in field and perform the same until nothing.

I can only find references to view collections, I cannot seem to run a loop on multiple values in a field.

Any help would be appriciated.

Paul

Sample code which may give an idea on what I am trying to achieve.

Sub Click(Source As Button)

'Set Dimensions

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim doc2 As NotesDocument

Dim item As NotesItem

'Get Current Document to work on

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

'Save current document

Call uidoc.Save

'Get database to create mini-doc in

'name1 = Get 1st name in AlarmList Field



'If Nothing Then 	

	'Call uidoc.Close

'Else 

	'Server = @If(@IsError(@DbLookup("":"NoCache";"":"names.nsf";"($Users)";@Name([Abbreviate];name1);"MailServer"));"";@DbLookup("":"NoCache";"":"names.nsf";"($Users)";@Name([Abbreviate];name1);"MailServer"))

	'mailfile = @If(@IsError(@DbLookup("":"NoCache";"":"names.nsf";"($Users)";name1;"MailFile"));"";@DbLookup("":"NoCache";"":"names.nsf";"($Users)";name1;"MailFile"))



	'Set db = session.Getdatabase ( server , mailfile)	



'Create mini-doc

Set doc2 = New NotesDocument(db)

Set item = doc.GetFirstItem("$Alarm")

Call item.CopyItemToDocument(doc2, "$Alarm")

Set item = doc.GetFirstItem("$AlarmOffset")

Call item.CopyItemToDocument(doc2, "$AlarmOffset")

Set item = doc.GetFirstItem("CalendarDateTime")

Call item.CopyItemToDocument(doc2, "CalendarDateTime")

Set item = doc.GetFirstItem("Subject")

Call item.CopyItemToDocument(doc2, "Subject")

'Save and move mini-doc to folder

Call doc2.Save(True , False , True)

Call doc2.PutInFolder ("($Alarms)")

'Close original document

Call uidoc.Close

End Sub

Subject: Simply…

FVal = NotesDocument.GetItemValue(“YourField”)For i = 0 To Ubound(FVal)

Set ldoc = NotesView.GetDocumentByKey(FVal(i), True)

… Do somthing with the lookup doc

Next

or

FVal = NotesDocument.GetItemValue(“YourField”)

Forall FV1 in FVal

Set ldoc = NotesView.GetDocumentByKey(FV1, True)

… Do somthing with the lookup doc

End Forall

Subject: RE: Simply…

umm…I’m a little new to this and can’t quite seem to see the logic path in this case. I need to return the value for ‘server’ & ‘mailfile’, run the code and then repeat for the next person listed in the field.

Could you see below and advise where I may be going off the beaten track.

If I have a Field called AlarmList with multiple values eg. CN=Paul Thomas/O=lotus, CN=Joe Bloggs/O=lotus, …

Dim FVal As Array

Dim i As Integer

Dim ldoc As Variant

FVal = doc.GetItemValue(“AlarmList”)

For i = 0 To Ubound(FVal)

Set ldoc = AlarmRecipients.GetDocumentByKey(FVal(i), True)

(This is code I need to convert to LS soon)

'Server = @If(@IsError(@DbLookup(“”:“NoCache”;“”:“names.nsf”;“($Users)”;@Name([Abbreviate];name1);“MailServer”));“”;@DbLookup(“”:“NoCache”;“”:“names.nsf”;“($Users)”;@Name([Abbreviate];name1);“MailServer”))

'mailfile = @If(@IsError(@DbLookup(“”:“NoCache”;“”:“names.nsf”;“($Users)”;name1;“MailFile”));“”;@DbLookup(“”:“NoCache”;“”:“names.nsf”;“($Users)”;name1;“MailFile”))

Set db = session.Getdatabase ( server , mailfile)