Hi all,
I'm currently trying to export a table into a csv file, I also want the first line in the csv file to be the field names.
By using the following code:
I can create a csv file containing everything I need. However, there is also the following character exported after the final line:
I cannot have accept that as this csv file is to be directly imported into another system and the will cause a crash.
So I tried using the following code:
This gives me all data without the field names, which I need!
Has anyone any ideas?
Thanks in advance,
Woody
I'm currently trying to export a table into a csv file, I also want the first line in the csv file to be the field names.
By using the following code:
Code:
exportspreadsheet("POHeader.db", ":WORK:POHeader1.csv", True )
I can create a csv file containing everything I need. However, there is also the following character exported after the final line:
I cannot have accept that as this csv file is to be directly imported into another system and the will cause a crash.
So I tried using the following code:
Code:
var
ts textsream
tc tcursor
mystring string
fieldnames Array[] string
cNum number
endvar
ts.open(":WORK:POHeader.csv","nw")
tc.open("POHeader.db")
tc.enumFieldnames(fieldNames)
cNum = 1
scan tc:
myString = ""
while cNum <= 7 ; the number of fields
myString = myString+tc.(fieldnames[cNum])
if cNum = 7 ; last field
then myString = myString+""
else myString = myString+","
endif
cNum = cNum+1
endWhile
ts.writeLine(myString)
cNum = 1
endscan
tc.close()
ts.close()
This gives me all data without the field names, which I need!
Has anyone any ideas?
Thanks in advance,
Woody