I need to create a doclink from two unrelated notes docs in one database. They share a common value in the NMasterNumber field. Here is my code(I’m not very good at LS). I can’t seem to get it to work. Can someone please help me?
Scenario (ReadersDigest version): Doc A: A user clicks on Create document button; documents are automatically created in sets of six: Documents #1 through #5 are initially blank documents-user fills in appropropriate info and enters nmasternumber; Document #6 will be a blank Monthly Summary document. When they open 6th doc, the nmasternumbers are automatically filled in from the previous five documents (lined up), e.g., 000033; 999393; 088383, 99999; 090909.
Doc b: That monthly summary report (doc 6) can then be sent to their manager by clicking on an action button (an agent). The manager sees the monthly summary that includes only the nmasternumber along with user comments.
GOAL: manager wants me to somehow put a doclink in the monthly summary doc next to each nmasternumber that will open the original document that had all of the info re: that specific nmasternumber (from the five original docs).
Make sense? How do I do this?
here is my code…
Dim session As NotesSession
Dim db As NotesDatabase
Dim vwManagement As NotesView
Dim collection As NotesDocumentCollection
Dim i As Integer
Dim docMonthlyQA As NotesDocument
Dim arraySendTo(4) As String
Dim doc As NotesDocument
Dim SuperName As String
Dim namSupervisor As NotesName
Dim black9plain As NotesRichTextStyle
Dim black9bold As NotesRichTextStyle
Dim black9ul As NotesRichTextStyle
Sub Initialize
Set session=New NotesSession
SuperName=""
Set db=session.CurrentDatabase
Set vwManagement=db.GetView("Management")
Set collection=db.UnprocessedDocuments
If (Not Collection Is Nothing) Then
For i = 1 To Collection.Count
Set doc=collection.GetFirstDocument
Next
End If
Set docMonthlyQA=db.CreateDocument
docMonthlyQA.Form="MonthlyMgmtReport"
'docMonthlyQA.Subject=“THIS IS TEST ONLY. PLEASE DISREGARD”
docMonthlyQA.Subject="Monthly Report - generated on " & Format$(Today, "mm/dd/yyyy")
Dim rtiBody As New NotesRichTextItem(docMonthlyQA, "Body")
Call SetTabs(rtiBody)
Call SetupFonts
Do While Not (doc Is Nothing)
Set namSupervisor=New NotesName(doc.TShiftSup(0))
If namSupervisor.Abbreviated<>SuperName Then
'new supervisor
SuperName=namSupervisor.Abbreviated
Call rtiBody.AppendStyle(black9bold)
Call rtiBody.AppendText("Shift Supervisor: " & namSupervisor.Common)
Call rtiBody.AddNewLine(1)
Call rtiBody.AppendStyle(black9ul)
Call rtiBody.AppendText("Rep")
Call rtiBody.AddTab(2)
Call rtiBody.AppendText("Dates Monitored")
Call rtiBody.AddTab(1)
Call rtiBody.AppendText("AC Nos")
Call rtiBody.AppendStyle(black9plain)
Call rtiBody.AddNewLine(1)
End If
Dim namTRep As New NotesName(doc.TRepresentative(0))
Call rtiBody.AppendText(namTRep.Common)
Call rtiBody.AddTab(1)
Call rtiBody.AppendText(Format$(doc.StartDate(0),"mm/dd/yyyy"))
Call rtiBody.AddTab(1)
Call rtiBody.AppendText(Format$(doc.EndDate(0),"mm/dd/yyyy"))
Call rtiBody.AddTab(1)
Forall a In doc.GetItemValue("NMasterNumber")
Call rtiBody.AppendText(a & "; ")
End Forall
I need to create a doclink after each ‘a’ mentioned above. The doclink goes to a more comprehensive form in the same database (‘HRM”) that gives details about each NmasterNumber individually.
Call rtiBody.AddNewLine(1)
If doc.Comments(0)<>"" Then
Call rtiBody.AppendStyle(black9bold)
Call rtiBody.AppendText("Comments: ")
Call rtiBody.AppendStyle(black9plain)
Call rtiBody.AppendText(doc.Comments(0))
Call rtiBody.AddNewLine(1)
End If
If doc.TrainingCounseling(0)<>"" Then
Call rtiBody.AppendStyle(black9bold)
Call rtiBody.AppendText("Training/Counseling: ")
Call rtiBody.AppendStyle(black9plain)
Call rtiBody.AppendText(doc.TrainingCounseling(0))
End If
Call rtiBody.AddNewLine(2)
Set doc=collection.GetNextDocument(doc)
Loop
'Call docMonthlyQA.Send(True, arraySendTo)
Call docMonthlyQA.Send(True, "JaneDoe")
Msgbox "The Monthly QA report is being generated and mailed to the someone for review.", 0, "Report Being Sent"
End Sub