Subject Re: format for .CSV file
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Wed, 12 Jun 2019 19:18:41 +0530
Newsgroups dbase.getting-started

On 12/06/2019 19:03, Matt Milner wrote:
> I use dBase Plus 12.
> I am writing an interface between my software and that of another company.
> They have asked for data to be transferred in .CSV format with the first line containing the list of field names in comma delimited format.  They have also stipulated that empty fields be represented by double quotes and numeric fields have quotes around the numbers.  Is there a simple way for me to comply?
>

Good Evening Matt,
In short the answer is no.
I tried
use inve.dbf
copy to sample.csv

It lacked on both counts field names were absent and there were no
quotes around numbers.

So the only option left is DIY with file object.

#define REC_LENGTH 80
#define IN_FILE "STUFF.REC"
#define OUT_FILE "STUFF.TXT"
fIn = new File()
fOut = new File()
fIn.open(IN_FILE)
fOut.create(OUT_FILE)
do while not fIn.eof()
    fOut.puts(fIn.read(REC_LENGTH))
enddo
fIn.close()
fOut.close()

is an example copied from help file. You will have to alter it slightly
to work with tables. I am just trying to give a sample. It is not tested.

#define OUT_FILE "STUFF.TXT"
use mytable.dbf
fOut = new File()
fOut.create(OUT_FILE)
fout.puts("place your field list here")
do while not eof('mytable')
    tstr = ["] + field1+[","]+str(field2,9,2)+["]
//build string as per your requirements
    fOut.puts(tstr)
    skip
enddo

fOut.close()
use

This will be easy if only 1 or 2 tables are involved. But tricky if
multiple tables are involved with different structures.

Regards
Akshat