I am using LotusScript to try and read a CSV file. One of the field values contains a comma, and hence the value is enclosed in double quotes.
The LotusScript is ignoring the double quotes just fine, but it is not treating the comma as part of the field value. It is separating the field value at the comma.
Does anybody know why?
Regards,
Charlie Zeaiter.
P.S. I am using Notes v6.0.2 CF1
For what it’s worth, here is the input file:
Sydney Uni, 0, 0, Australia
“Uni of Tech, Sydney”, 0, 0, Australia
And here is the Lotus Script:
Sub Initialize
Dim inputfilenum As Integer
inputfilenum = Freefile()
Open "c:\temp.txt" For Input As inputfilenum
Dim strCol1 As String
Dim strCol2 As String
Dim strCol3 As String
Dim strCol4 As String
Do While Not Eof (inputfilenum)
Input #inputfilenum, strCol1, strCol2, strCol3, strCol4
Messagebox "1: " + strCol1 _
+ Chr(10) + "2: " + strCol2 _
+ Chr(10) + "3: " + strCol3 _
+ Chr(10) + "4: " + strCol4
Loop
Close #inputfilenum
We use LotusScript to upload comma delimited files alot and have had the problem you are facing. We found it is best to load the line into a single variable and then parse out the fields ourselves. This will give you control over what gets parsed out. For example if you find a quote you can continue to parse until you come across the end quote.