Transfering a text file

Hello All - I need to send a txt file that I create through an notes agent an push it to a folder on another non notes server. My company requires that I use LEI. What type of configuration should I be using to set this up?

Thanks

Pat

Subject: Transfering a text file

Here’s an example I use to write to a non-notes server:

Print “Start Create Asset Listing Text File agent…”

Dim s As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument

Dim tmp, filename As Variant

Dim x, z, tmp2, tmp3, tmp4, datestamp, textfileName As String	

Dim dateTime As New NotesDateTime("")

Dim filenum As Integer



'****added agent log code

Dim agent As notesagent

Dim agentlog As New NotesLog ("Agentlog")

Set agent = s.currentagent	

Call agentlog.openagentlog

On Error Goto errorprocess



Set db = s.CurrentDatabase

Set view = db.GetView("Asset Listing")

Set doc = view.GetFirstDocument 



dateTime.LSLocalTime = Now

x = dateTime.DateOnly

tmp = Left$(x,2)

tmp2 = Right$(x,1)

tmp3 = Right$(x,7)

tmp4 = Left$(tmp3,2)



datestamp = tmp2 + tmp + tmp4 + "1"

'filename = "AssetListing"

'This is the path and the name of the text file (Text.txt) that will be created.

'z = "f:\\Shared\Asset Listing\"+filename+datestamp+".txt"   '  olympus server

'z = "i:\\AssetListing\"+filename+datestamp+".txt"   ' iris server

'z = "z:\\AssetListing\"+filename+datestamp+".txt"   ' zeus server

'z = "\\Olympus\Shared\Asset Listing\"+filename+datestamp+".txt"

z = "\\athena_test\database$\"+datestamp



Close 1

'Opens the text file 

Open z For Output As 1  



'Header info

Print #1, "asset"+ "," +"vin"+ "," +"make"+ "," +"model"+ "," +"year"+ "," +"loadcap"+_

"," +"gvw"+ "," +"miles"+ "," + "hours"+ "," + "equipgroup"+ "," + "status"+ "," +_

+ "," + "store"+ "," + "region"+ "," + "pmschlast"+ "," + "pmschnext"+ "," + "license"+_

"," + "licensestate"+ "," + "licexpir"+ "," + "mviexpir"+ "," + "dateinfleet"+ "," +_

"dateoutfleet"+ "," + "fuel"+ "," + "trans"+ "," + "numaxle"+ "," + "stdtiresize"+ "," +_

"cdlreq"+ "," + "brakes"

'If the text file already exists, this will delete the old file and create a new one

'If Not fileName ="" Then

'	Kill infile 

'End If

'Get an unused file number so LotusScript can open a file.

fileNum% = Freefile() 

'Adds the asset listing fields to the text file

While Not doc Is Nothing

	Print #1, doc.asset(0)+ "," +doc.vin(0)+ "," +doc.make(0)+ "," +doc.model(0)+ "," +doc.year(0)+_

	"," +doc.loadcap(0)+ "," +doc.gvw(0)+ "," +doc.miles(0)+ "," + doc.hours(0)+ "," + doc.equipgroup(0)+_

	"," +doc.status(0)+ "," +doc.store(0)+ "," +doc.region(0)+ "," +Cstr(doc.pmschlast(0))+_

	"," +Cstr(doc.pmschnext(0))+ "," +doc.license(0)+ "," +doc.licensestate(0)+ "," +Cstr(doc.licexpir(0))+_

	"," +Cstr(doc.mviexpir(0))+ "," +Cstr(doc.dateinfleet(0))+ "," +Cstr(doc.dateoutfleet(0))+ "," +doc.fuel(0)+_

	"," +doc.trans(0)+ "," +doc.numaxle(0)+ "," +doc.stdtiresize(0)+"," +doc.cdlreq(0)+_

	"," +doc.brakes(0)

	

	

	Set doc = view.GetNextDocument(doc)

Wend

'Closes the text file

Close #fileNum% 

Dim lineN As Integer

Call agentlog.logaction(Cstr(lineN-1) + "records written to " + z)

done:

Call agentlog.close

Exit Sub

errorprocess:

Dim n As String

n = agent.name

Call agentlog.logaction(n & " agent - Error # " & Cstr(Err) & " has occurred on line " & Cstr(Erl) & " ====> " & Error$)

Call agentlog.close

Exit Sub



Print "Complete Creating Asset Listing Text File agent..."

Subject: Transfering a text file

You will want to create a Connection doc of type ‘Notes’ for the server and database where the file is coming from and another Connection doc of type ‘File’ for the server and path that will be receiving the files. Then you create an Activity doc, most likely of type ‘Direct Transfer’ which defines what documents to select and how to map the fields.

Using LEI is really only good if you are putting the files in a format where they would be imported into tables in another database system. If this is what you are doing, then I would investigate making a direct transfer to the other system and skip the file export and import steps. If this is not the type of data transfer you are doing (for example if you are trying to write log files or other similar data), I would recommend just using and agent to create the files directly on the file shares and skip LEI.

Subject: RE: Transfering a text file

Paul - I created an agent which grabs the calendar events in a group mailbox to create a text file.

This text file needs to be pushed to a data folder on another server. I pick up the file and run a script against it then import it into a sql db. I think sending the text file via the fileshare it the way to go. How do I link to a fileshare in my script? Currently I am just creating the file in a folder on my c drive.

Thanks

Pat