Hello,
We are in the middle of our migration from 4.6.7 to ND6. I have a scheduled lotusscript agent that exports field values from databases to a flat file delimiting them with a “|”. This agent ran great under R4 and the values came out as expected as shown here:
“…E34025|sales_01.nsf|821B0BCF269A173C852566E1005DF94F| |FLOWERS BAKERY|5055 S ROYAL ATLANTA DR|…”
When I ran this under 6.0.1CF1, I noticed that the there was an extra delimited value being exported, as shown here between the DOCID and Flowers (company name), as shown here:
“…E34025|sales_01.nsf|821B0BCF269A173C852566E1005DF94F| || |FLOWERS BAKERY|5055 S ROYAL ATLANTA DR|…”
If you notice, there are two null values between the DOCID and the Flowers. The code is exactly the same and the only difference is the server software now on Domino 6.0.1CF1
Anyone have any insight at all? I’m a little baffled about this.
Here is the LotusScript. The extra PIPES are coming in at this point in the code and I also highlighted it in the code but here is a snipit of it:
Print #OutFileNumber,doc.Universalid+“|”;
Print #OutFileNumber,doc.Mailings(0)+“|”;
You’ll see it halfway down during the output to the flat file:
Dim theDirectory,outputpath As String
Dim session As New NotesSession
Dim currentDB As Integer
Dim Server As String
Dim view As notesview
Dim doc As notesdocument
Dim dbthis As notesdatabase
Dim exported As Long
Dim addressFormat As String
Dim addressLines As Variant
Dim richtext As Variant
Dim xlog As noteslog
Dim result As Variant
Dim days As Integer
Dim nlog As noteslog
Dim hlog As noteslog
Dim DStart, Dend As Integer
Dim change_days_threshold As Integer
Dim Dst, Est, Tst, TDir As Variant
Dim rtitem As Variant
Dim plainText As String
Dim categories As Variant
Dim laststreet As String
Dim agent As notesagent
On Error Goto PROCESS_ERROR
outputpath="D:"
theDirectory= "SIS"
' Load parameters
Dst = Evaluate(|@GetProfileField("ExportParametersCompany";"StartDistrict")|)
DStart = Cint(Dst(0))
Est = Evaluate(|@GetProfileField("ExportParametersCompany";"EndDistrict")|)
DEnd =Cint(Est(0))
Tst=Evaluate(|@GetProfileField("ExportParametersCompany";"DaysThreshold")|)
change_days_threshold=Cint(Tst(0))
TDir = Evaluate(|@GetProfileField("ExportParametersCompany";"ExportDirectory")|)
If(TDir(0) <> "") Then
outputPath=TDir(0)
End If
server = session.currentdatabase.server
Set dbthis=session.currentdatabase
OutFileNumber = Freefile
dummyfilenumber = Freefile
'if agent is running on the server indicate that the agent is running
' by creating a flag file
If(session.isonserver) Then
Set xLog = New NotesLog( "Company Export\" + Date$ + " - " + Time$ )
Call xLog.OpenNotesLog( server,session.currentdatabase.Filepath)
Call xLog.logAction("Started Parameters->Dist Start:"+Str(DStart)+" Dist End:"+Str(Dend)+" Days Threshold:"+Str(change_days_threshold) )
Open outputpath+"\NT_COMPANY" For Output As DummyFileNumber
Close DummyFilenumber
End If
Open outputpath+"\"+FileName For Output As OutFileNumber
For currentDb= DStart To DEnd
Dim db As New notesDatabase("","")
If ( db.open(server,thedirectory+"\sales_"+Format(currentDB,"00"))) Then
If(Not session.isonserver) Then Print "Exporting District:"+Str(currentDB)
Set view = db.getview(TargetView)
Set doc = view.getfirstdocument()
While Not (doc Is Nothing)
days = Cint( Date - doc.LastModified )
If days < change_days_threshold Then
Dim name1 As New notesname(doc.SalesRep(0) )
Dim name2 As New notesname(doc.SalesRep2(0) )
Dim name3 As New notesname(doc.Specialist(0) )
Dim name4 As New notesname(doc.SalesPerson2(0) )
Print #OutFilenumber,"C"+"|";
Print #OutFileNumber,doc.CustomerNo(0)+"|";
Print #OutFileNumber,doc.Company(0)+"|";
Print #OutFileNumber,doc.City(0)+"|";
Print #OutFileNumber,doc.Region(0)+"|";
Print #OutFileNumber,doc.County(0)+"|";
Print #OutFileNumber,doc.Branch(0)+"|";
Print #OutFileNumber,doc.NWSalesForce(0)+"|";
Print #OutFileNumber,doc.TargetPriority(0)+"|";
Print #OutFileNumber,doc.Corporate(0)+"|";
Print #OutFileNumber,doc.District(0)+"|";
Print #OutFileNumber,doc.TelesalesIndustry(0)+"|";
Print #OutFileNumber,name1.Abbreviated+"|";
Print #OutFileNumber,name2.common+"|";
Print #OutFileNumber,doc.Addressgroup(0)+"|";
Print #OutFileNumber,doc.ShortName(0)+"|";
Print #OutFileNumber,db.FileName+"|";
***HERE---->Print #OutFileNumber,doc.Universalid+"|";
Print #OutFileNumber,doc.Mailings(0)+"|";<-----***
'Default foreign format address to 8 lines
addressFormat=doc.ForeignFormatAddr(0)+"|"+"|"+"|"+"|"+"|"+"|"+"|"+"|"
addressLines = explode(addressFormat,"N")
Print #OutFileNumber,addressLines(0)+"|";
Print #OutFileNumber,addressLines(1)+"|";
Print #OutFileNumber,addressLines(2)+"|";
Print #OutFileNumber,addressLines(3)+"|";
Print #OutFileNumber,addressLines(4)+"|";
Print #OutFileNumber,addressLines(5)+"|";
Print #OutFileNumber,addressLines(6)+"|";
Print #OutFileNumber,addressLines(7)+"|";
Print #OutFileNumber,addressLines(8)+"|";
Print #OutFileNumber,name3.Abbreviated+"|";
If(Isnumeric(doc.Contact(0))) Then
Print #OutFileNumber,Str$(doc.Contact(0))+"|";
Else
Print #OutFileNumber,doc.Contact(0)+"|";
End If
Print #OutFileNumber,doc.Country(0)+"|";
Print #OutFileNumber,doc.Telephone(0)+"|";
Print #OutFileNumber,Format$(doc.VerifiedDate(0),"mm/dd/yyyy")+"|";
Print #outFileNumber,name4.Abbreviated+"|";
addressLines = explode(doc.Street(0)+" |"+"| "+"|","N")
Print #outFileNumber,addressLines(0)+"|";
Print #outFileNumber,doc.Addressgroup(0)+"|";
' get first 50 lines of body field which is comments
Set rtitem = doc.GetFirstItem( "Body" )
If ( Not (rtitem Is Nothing)) Then
plainText = rtitem.GetFormattedText( True, 0 )
richText = explode(plainText+" |"+"| "+"|","N")
Print #outFileNumber,Left$( richText(0) , 50)+"|";
Else
Print #outfilenumber, "|";
End If
Print #outfilenumber,doc.IFMType(0)+"|";
categories = Evaluate(|@implode(Categories;"~");|,doc)
Print #outfilenumber, categories(0)+"|";
Print #outfilenumber, doc.Market(0)+"|";
Forall item In doc.Environment
If(item<>"")Then
Print #OutFileNumber ,item+";";
End If
End Forall
Print #OutFileNumber ,"|";
Print #OutFileNumber, doc.ID(0)+"|";
’ output street 2 line
result =Evaluate(|@explode(Street;@char(11))|,doc)
If Ubound(result)>=1 Then Print #OutFileNumber, result(1);
Print #OutFileNumber ,"|";
’ new output fields added 05/13/2002
Dim x As Variant
x=Evaluate(|@replacesubstring(MCompany;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
x=Evaluate(|@replacesubstring(MCompany2;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
x=Evaluate(|@replacesubstring(MStreet;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
x=Evaluate(|@replacesubstring(MCity;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
x=Evaluate(|@replacesubstring(MRegion;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
x=Evaluate(|@replacesubstring(MZip;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
x=Evaluate(|@replacesubstring(MCountry;@newline:@char(10):@char(13):"\"";"":"":"":"'")|,doc)
Print #OutFileNumber, clean(x)+"|";
’ end output line
Print #outFileNumber,""
exported = exported+1
' log error if foreign format address is blank
If( addressLines(0) ="") Then
If(session.isonserver) Then
Call xLog.logerror(2,"Customer has incorrect address format-->"+doc.CustomerNo(0)+" District:"+doc.District(0) )
End If
End If
Forall projects In doc.Categories
If(projects<>"")Then
Print #OutFileNumber ,"M"+"|"+projects+"|"+doc.Universalid
End If
End Forall
End If
Set doc = view.getnextdocument(doc)
Wend
End If
Next
' if running on a server indicate problems and or log results
If(session.isonserver) Then
Close OutFileNumber
Set agent = dbthis.getagent("(File Copy of Company Export(daily))")
Call agent.run()
If exported =0 Then
Call xLog.logerror(1,"Exported 0 Documents!" )
Call Mail_message("Company Export Agent Did not export any document! Look into it?","Group/ef_Notes_admin/efector/ifm/US")
Else
Call xLog.logAction("Finished running: Exported:"+Str(exported)+" documents")
End If
Kill outputpath+"\\"+"NT_COMPANY"
End If
Exit Sub
Process_Error :
If(session.isonserver) Then
Call xLog.logerror(1,"Error---> "+Error$ )
Call Mail_message("There has been an error in the company export main agent! Check log:" + Date$ + " - " + Time$,"Group/ef_Notes_admin/efector/ifm/US")
Else
Msgbox "Error: "+Error$
End If
Exit Sub
End Sub