I have some old app in VFP6 SP5 and I wanted to export some tables into file by using COPY TO. But despite all my tries to remove quotation marks around text field content they remained there or I got error! In VFP9 it goes well, but here it won't! I need just character ; between fields and nothing more but couldn't help myself. Due that I wrote some prg that did ti for me:
If anybody has better solution I would like to see it. Thank you.
There is no good nor evil, just decisions and consequences.
Code:
*dump free table to file without quotation marks
*Visual FoxPro 6
*E.Podic ©2010 aka Littlefloor
clear
tbl='kolegij'
use (tbl)
bp=fcount((tbl))
go top
nof='out_'+tbl+'.txt'
n1 = fcreate(nof)
cstring=''
scan all
for sb=1 to bp
p=alltrim(field(sb))
do case
case type('&p')='C'
cString = cstring+alltrim(&p)+';'
case type('&p')='D'
cString = cstring+dtoc(&p)+';'
case type('&p')='N'
cString = cstring+alltrim (str((&p), fsize(p)))+';'
case type('&p')='U'
cString = cstring+alltrim (str((&p),0))+';'
case type('&p')='L'
cString = iif(&p=.f., cstring+'0'+';', cstring+'1'+';')
endcase
next sb
=fput(n1,cString)
cstring=''
endscan
=fclose(n1)
close data
There is no good nor evil, just decisions and consequences.