OpenNTF.org - Write Out Field Values To A Cs
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Write Out Field Values To A Csv File 
Rating:
Not Rated Yet 
Contributor:
Andrew Jones 
Category:
Lotusscript 
Type:
 
Last Modified:
17 Jun 2002 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description





Function WriteValuesToFile(viewTarget As NotesView, varFieldNames As
Variant,strFileName As String) As Integer
Dim intFileNum As Integer
Dim intArraySubscript As Integer
Dim vecViewTarget As NotesViewEntryCollection
Dim ventViewTarget As NotesViewEntry
Dim docViewTarget As NotesDocument
Dim strFieldName As String
Const Quote = {"}
Const Delim = {,}
Const EndLine = {;}

Set vecViewTarget = viewTarget.AllEntries

If vecViewTarget.count < 1 Then 'Check for values to retrieve before opening a
file handle

WriteValuesToFile = False
Exit Function

Else
WriteValuesToFile = True
End If

intFileNum = Freefile()

Open strFileName For Output As #intFileNum

Set ventViewTarget = vecViewTarget.GetFirstEntry 'Get 1st entry in view

Do While Not ( ventViewTarget Is Nothing) ' for all the documents in the
view, print out the desired field values to the file
Set docViewTarget = ventViewTarget.Document
strDocRecord = ""
For intArraySubscript = 0 To Ubound(varFieldNames)

strFieldName = varFieldNames(intArraySubscript)

Set itmNeeded = docViewTarget.GetFirstItem(strFieldName)

If strDocRecord = "" Then

strDocRecord = Quote & itmNeeded.text & Quote
Else


strDocRecord =strDocRecord & Delim & Quote & itmNeeded.text & Quote

End If


Next intArraySubscript
strDocRecord =strDocRecord & EndLine 'Here is the whole delimited string to
go on a line in the file
Print #intFileNum, strDocRecord


Set ventViewTarget = vecViewTarget.GetNextEntry(ventViewTarget)
Loop


Close #fileNumInt

End Function


Usage / Example
 Comments

No documents found

 Add your comment!