Hi Friends i am very new to lotus notes and i have a query which i am not able to solve.
I have created a agent with lotus script in lotus notes which generates text file with the View Details.
Option Public
Sub Initialize
MsgBox " Agent AccessUserList"
On Error GoTo HandleError
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim embobj As NotesEmbeddedObject
Dim rtitem As NotesRichTextItem
Dim ErrMsg As String
Dim dateTime As New NotesDateTime( "" )
dateTime.LSLocalTime = Now
UserListDate = dateTime.DateOnly
TheDate=Format(Now(),"mmdd")
filename = CurDrive$()+"\color\"+"Colors_" +TheDate+"Selection_OP" +".txt"
MsgBox filename
Set db = session.CurrentDatabase
On Error GoTo LogErr
Dim v As NotesView
Dim s As New NotesSession
Dim ec As NotesViewEntryCollection
Dim ent As NotesViewEntry
Dim filePath As String, valString As String
Dim myStream As NotesStream
Dim fileNum As Integer, count As Integer, x As Integer
Set myStream = s.Createstream()
Call myStream.Open(filename, "ASCII")
Call myStream.Truncate()
Set db = s.CurrentDatabase
MsgBox "BEFORE ENTER VIEW"
'Call myStream.Writetext(i.Title, 0)
Set v = db.GetView("SelectCustomer")
MsgBox "Entered View"
If (v Is Nothing) Then
MsgBox "View does not exist"
Exit Sub
End If
count = v.Columncount
ForAll i In v.Columns
If i.Position = count Then
Call myStream.Writetext(i.Title, 0)
Else
Call myStream.Writetext(i.Title & "||")
End If
End ForAll
MsgBox "AFTER COLUMN"
Set ec = v.Allentries
Set ent = ec.Getfirstentry()
While Not ent Is Nothing
x = 1
ForAll j In ent.Columnvalues
If IsArray(j) Then
valString = |"| & Join(j, ",") & |"|
Else
If InStr(j, ",") > 0 Then
valString = |"| & j & |"|
Else
valString = j
End If
End If
If x = count Then
Call myStream.Writetext(valString, 0)
Else
Call myStream.Writetext(valString & "||")
End If
x=x+1
End ForAll
Set ent = ec.Getnextentry(ent)
Wend
closeFile:
Call myStream.Close()
Exit Sub
HandleError:
MsgBox "Error - " & Error &" at line number " & Erl
Exit Sub
LogErr:
Resume closeFile
Exit Sub
End Sub
This is above code which generates the file in server with the details.
But i want only the empty file which generates everyday when i start the crone in the particular folder I tried to remove all the unwanted code but if i comment any code i will not get error but the file will never get generated.
*Can anyone help me to edit this code i need to generate simple empty text file everyday which all the lines i should edit in this code *
Thanks for your time and help.