Or to - Get code to loop

IF there is a second form = “pdf” that = “Student Report” - can I get Notes to write it out as:

[doclink] Student Report for budget number

[doclink] Student Report for budget number (page 2)

Subject: Or to - Get code to loop

You need to do a separate AppendDoclink (and an AddNewLine) for each of the links you want to create – and you can create the string separately for each doclink instance.

Subject: RE: Or to - Get code to loop

Stan - can you give me an example?

Subject: Or to - Get code to loop

Based on what I could make out from description of problem:

This script creates a new mail memo. In the Body item of the memo, the script places a doclink to each document in the Boots folder in the TEST.NSF database. Each doclink is followed by a tab, the Subject item of the document being linked to, and a carriage return.

Dim session As New NotesSession

Dim db As New NotesDatabase(“”, “test.nsf”)

Dim view As NotesView

Dim newDoc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim doc As NotesDocument

Dim dc As NotesDocumentCollection

Dim query As String

query = |Form=“PDF” And Field1 =“Student report”|

Set dc = db.search( query, Nothing, 0 )

Set newDoc = New NotesDocument( db )

Set rtitem = New NotesRichTextItem( newDoc, “Body” )

Set doc = view.GetFirstDocument

Dim i As Integer

i = 1

While Not ( doc Is Nothing )

Call rtitem.AppendDocLink( doc, “” )

Call rtitem.AppendText(“Student Report for budget number” + Cstr(i))

i = i + 1

Set doc = view.GetNextDocument( doc )

Wend

Call newDoc.Save( True, True )

Subject: RE: Or to - Get code to loop

Litty - This isn’t creating a mail memo, but creating a doclink and text onto a form in a richtext field. I need the code to loop through a view and create a doclink and title for each instance where the budget number matches the main form that is being opened.