Subject: RE: redim preserve issue
Here is my full code. I need to insert a piece to loop through values of my field “key” building the array. I’m trying to use the viewentry collection to get the newdocs order. I’m not sure if this is possible with viewentry collection. Thanks!
Here is what I want to add to loop throught the field, building the array:
Dim item As NotesItem
Set item = NewDoc.GetFirstItem( “key” )
Forall v In item.Values ???
…here is the full code…
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim rtitem As NotesRichTextItem
Dim key As Variant
x = 0
Dim DocOne As NotesDocument
Dim NewDoc As NotesDocument
Dim ViewOne As NotesView
Set ViewOne = db.Getview(“ViewOne”)
Set DocOne = ViewOne.GetFirstDocument
While Not (DocOne Is Nothing)
Set NewDoc = DB.CreateDocument
Set rtitem = New NotesRichTextItem(NewDoc, “Link”)
NewDoc.form = “form1”
NewDoc.sendto = DocOne.sendto(0)
NewDoc.type = DocOne.type(0)
NewDoc.title = DocOne.title(0)
NewDoc.subject = DocOne.title(0)
key = DocOne.group(0) - * need to loop through values of field building array - place values on Newdoc
Dim ViewTwo As NotesView
Dim Ventry As NotesViewEntry
Dim VeCol As NotesViewEntryCollection
Dim DocTwo As NotesDocument
Set db = session.CurrentDatabase
Set ViewTwo = db.Getview(“ViewTwo”)
Set VeCol = ViewTwo.GetAllEntriesByKey(key, True)
Set Ventry = VeCol.GetFirstEntry()
While Not (Ventry Is Nothing)
Set DocTwo = Ventry.Document
If x = 0 Then
Redim tmp1(x)
Redim tmp2(x)
Redim tmp3(x)
Else
Redim Preserve tmp1(x)
Redim Preserve tmp2(x)
Redim Preserve tmp3(x)
End If
tmp1(x) = DocTwo.fied1(0)
tmp2(x) = DocTwo.field2(0)
tmp3(x) = DocTwo.field3(0)
Set Ventry = VeCol.GetNextEntry(Ventry)
Wend
NewDoc.fielda = tmp1
NewDoc.fieldb = tmp2
NewDoc.fieldc = tmp3
Call NewDoc.Send( True, NewDoc.SendTo )
Set DocOne = ViewOne.GetNextDocument(DocOne)
Wend
Call rtitem.Update
End Sub