I’m new to LS and could use some help. I need to export some fields from a Response Document. I understand there is not an easy way to show just the responses without the parents in a view, so I’m trying to export just the fields I need instead of the whole view. The first thing I need to ask is how to get the fields from just the response forms only. I’ve included the script I’ve been using that does some of what I need; but I have 10 question fields and 10 corresponding comment fields I need to collect. Question fields are a to j, with comment fields being a_1 to j_1. I’m unsure how to pick them up in the order a, a_1, b, b_1. Help…
Sub Initialize
Set session = New NotesSession
Set db = session.CurrentDatabase
Set coll = db.UnprocessedDocuments
docCt = 0
fileNum% = Freefile()
fileName = "c:\windows\desktop\SurveyResults.txt"
If coll.count = 0 Then
Msgbox "No documents to process"
Exit Sub
Elseif coll.count > 1000 Then
Msgbox "Please limit your selection to 1000 documents or fewer"
Exit Sub
Else
Set doc = coll.GetFirstDocument
End If
Open fileName For Output As fileNum%
While Not doc Is Nothing
Set notesFrom = New NotesName(doc.GetItemValue("From")(0))
docFrom = notesFrom.Common 'doc.GetItemValue("From")(0)
'Comments is an extra optional field
dataArr(docCt) = docFrom & "," & doc.Comments
'gather all the field data into an array
For i = 97 To 106 'lowercase a through j
fieldToGet = Chr(i)
dataArr(docCt) = dataArr(docCt) & "," &_
doc.GetItemValue(fieldToGet & "_1")(0)
fieldCt = fieldCt + 1
Next
docCt = docCt + 1
Set doc = coll.GetNextDocument(doc)
Wend
'write all the array data to a file
Forall d In dataArr
’ Print d
Print #fileNum%, d
End Forall
Close fileNum%
End Sub