Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to create a comma delimited

Status
Not open for further replies.

michlm

Programmer
Sep 3, 2000
44
US
I need to create a comma delimited text file from my Notes database. I see my only options (other than bringing the info into Excel and then creating my file) as a structured text file and tabular text file but I'm not sure if there is a way to make either of these comma delimited.

So, I guess what I'm looking for is what exactly is it that I need to do to export/create a comma delimited text file from my Notes database?

Any help out there would be appreciated!

Thanks.

Michelle
 
Hello Michelle,

The following basic code will create a text file which you can fill in yourself, I hope this will help you.


CODE:

Dim fileNum As Integer
Dim fileName As String

' Ask for the text file name ...
filename$ = Inputbox$("Enter name file. Ex: c:\test.txt", "Data Entry Box", "c:\test.txt")
If filename$ = "" Then
Exit Sub
End If

' Create the file with...
fileNum% = Freefile()
Open fileName$ For Output As fileNum%

' Insert a openings sentence...
Write #fileNum%, "This is a test text file"

' You can use variables to write to the txt file...
naam = "test2"

' write the text or the variable to the txt file...
Write #fileNum%, "test" & ";", naam & ";"

'Important, close the file...
Close fileNum%
 
Derk,

Will that allow me to create the delimited text file from a view?

Sorry so many questions. I'm a newbie . . . .

Thanks.

Michelle

 
Hello Michelle,

Yes, I hope you are a bit familiar with lotusscript?

If so you can use the lotusscript classes notesview and notesdocument to retrive the data from the view you want to export to the text file.

If you have more questions. Please ask, maybe I can help.
Below there is a little example from retriving data form a view to a delimited text file .
I hope this will help you.

example:

' declarations
dim s as new notessession
dim db as notesdatabase
dim view as notesview
dim doc as notesdocument
Dim fileNum As Integer
Dim fileName As String

' Initialize
set db = s.CurrentDatabase
set view = db.GetView( "[ViewNaam]" )

' Get the first document from the view ....
set doc = view.GetFirstDocument

' Ask for the text file name ...
filename$ = Inputbox$("Enter name file. Ex: c:\test.txt", "Data Entry Box", "c:\test.txt")
If filename$ = "" Then
Exit Sub
End If

' Create the file with...
fileNum% = Freefile()
Open fileName$ For Output As fileNum%

' Insert a openings sentence...
Write #fileNum%, "This is a test text file"


Do While Not doc Is Nothing

' You can use variables to write to the txt file...
field1 = doc.[FieldName1](0)
field2 = doc.[FieldName2](0)

' write the text or the variable to the txt file...
Write #fileNum%, field1 & ";", field2 & ";"


' Get the next document from the view..
set doc = view.GetNextDocument
Loop

'Important, close the file...
Close fileNum%
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top