jessiejane
Programmer
Hi,
I have a temp file (temp.txt) and purge file (purge.txt)
I compare the data in the temp file against the purge file and if the record exists in both the files I do not add the data, if the record in the temp file does not exist in the purge file, I append the data to the purge file.
When I append the data it adds in the same line instead of n
ew line and then adds other records to the new line
Any help is really appreciated.
****************
temp.txt
-----------------
John-02/03/2010
Mary-04/15/2010
Richard-05/17/2010
*****************
*****************
Purge.txt
-----------------
Mary-02/12/2010
*****************
________________________________
Mary-02/12/2010John-02/03/2010
Richard-05/17/2010
________________________________
The output looks like above but I need the records to have in a seperate line like the below one
________________________________
Mary-02/12/2010
John-02/03/2010
Richard-05/17/2010
________________________________
Code:
For int i = 1 to 3
strUserFound = False
For j = 1 to 1
if ucase(Mid(arrTemp(i - 1),1,(instr(1,arrTemp(i-1),"-")-1)))= ucase(Mid(arrPurge(j - 1),1,(instr(1,arrPurge(j-1),"-")-1))) then
strUserFound = True
Exit for
end if
Next
If strUserFound <> True then
EventLog ucase(Mid(arrTemp(i - 1),1,(instr(1,arrTemp(i-1),"-")-1))) & "-" & Date, strPurgeFile
End If
Next
Sub EventLog(ByVal strLogValues, ByVal strFile)
Dim objTextFile, objCreateFile
if objFSO.FileExists(strDirectory & strFile) <> True then
Set objCreateFile = objFSO.CreateTextFile(strDirectory & strLogFile, True)
objCreateFile.Close
End if
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, strAppendingValue, True)
objTextFile.Writeline(strLogValues)
objTextFile.Close
End Sub
I have a temp file (temp.txt) and purge file (purge.txt)
I compare the data in the temp file against the purge file and if the record exists in both the files I do not add the data, if the record in the temp file does not exist in the purge file, I append the data to the purge file.
When I append the data it adds in the same line instead of n
ew line and then adds other records to the new line
Any help is really appreciated.
****************
temp.txt
-----------------
John-02/03/2010
Mary-04/15/2010
Richard-05/17/2010
*****************
*****************
Purge.txt
-----------------
Mary-02/12/2010
*****************
________________________________
Mary-02/12/2010John-02/03/2010
Richard-05/17/2010
________________________________
The output looks like above but I need the records to have in a seperate line like the below one
________________________________
Mary-02/12/2010
John-02/03/2010
Richard-05/17/2010
________________________________
Code:
For int i = 1 to 3
strUserFound = False
For j = 1 to 1
if ucase(Mid(arrTemp(i - 1),1,(instr(1,arrTemp(i-1),"-")-1)))= ucase(Mid(arrPurge(j - 1),1,(instr(1,arrPurge(j-1),"-")-1))) then
strUserFound = True
Exit for
end if
Next
If strUserFound <> True then
EventLog ucase(Mid(arrTemp(i - 1),1,(instr(1,arrTemp(i-1),"-")-1))) & "-" & Date, strPurgeFile
End If
Next
Sub EventLog(ByVal strLogValues, ByVal strFile)
Dim objTextFile, objCreateFile
if objFSO.FileExists(strDirectory & strFile) <> True then
Set objCreateFile = objFSO.CreateTextFile(strDirectory & strLogFile, True)
objCreateFile.Close
End if
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, strAppendingValue, True)
objTextFile.Writeline(strLogValues)
objTextFile.Close
End Sub