This morning, I have a question for a member of mailing list, how we can
import data from a text file. Well I just have the code for that. Is quite
simple on how to import the data from a text file, but what you gonna do
with the data, is another question.
This a cut version of my lotusscript agent. I only show how we import the
data from a text file. My agent, actually use the data to create new
documents in notes database. The text file should located in the server
where the agent run. Also the signer of the agent must have appropriate
rights in the server.
In the agent, you will see the NoteLog object. Well, I have a habit to
create a log on every agent that I created. So I can troubleshoot the agent
easily if something goes wrong.
Dim fileNum As Integer
Dim strLine As String
‘//=====prepare for loging
Dim currentLog As New NotesLog( “Import data from text file” )
Call currentLog.OpenNotesLog( “”, “AMgrLog.nsf” )
fileNum = Freefile()
Open “c:\data\import\sample.txt” For Input As fileNum
Call currentLog.LogAction( “Import data from text file – Start”)
Do While Not Eof (fileNum)
Line Input #fileNum, strLine
‘//===now you have strLine variable that you can manipulate as
Call currentLog.LogAction( “Import data from text file – End”)
Now, you have it and have fun.