Extracting names from Embedded view
Posted on 2007-10-10
Have a form which I am using an embedded view setup to log attendees for training sessions, in the past I have hard coded a table of attendees and used the code below to extract all the attendee names and send a letter asking them to take a survey on their training. Is their a way to extract the attendee names from the embedded view for that particular session? Can I tie it to the unique number field which is what I am tying the embedded view together with the record. Basically pull that unique field and look to all the attendee records with the same number and pull that name.
This is the code I used to send the note in the past.
Dim db As NotesDatabase
Set s = New NotesSession
Set db = s.CurrentDatabase
Dim dc As NotesDocumentCollection
Set dc = db.UnprocessedDocuments
Dim varNames(49) As String
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim installDate As NotesDateTime
Dim installTimeItem As NotesItem
Dim item As NotesItem
Dim i As Integer
On Error Resume Next
Set docA = dc.GetFirstDocument
For i = 1 To dc.Count
Set docA = dc.GetNthDocument( i )
If docA.form(0) = "conf_call_survey" And docA.survey_sent(0) <> "done" Then ' this is the document you're pulling names FROM
Set docB = db.CreateDocument
docB.form = "feedback_request" ' the document you want to email
docB.Subject = "Please take a moment to provide feedback on the " + docA.topic(0) + " conference call you recently attended. "
varNames(0) = docA.name(0)
varNames(1) = docA.name_1(0)
varNames(49) = docA.name_49(0)
Set installTimeItem = docA.GetFirstItem("date")
Set installDate = installTimeItem.DateTimeValue
docB.SendTo = varNames
docB.CopyTo = docA.trainer
docB.topic = docA.topic
docB.topic1 = docA.topic
docB.trainer = docA.trainer(0)
docA.survey_sent = "done"
Call docB.Send (True)
message = "You have already sent a survey request for this class. This request will not be sent."
Messagebox message, MB_OK, "Alert!!"