Am 29.12.2017 um 19:16 schrieb sudeep sharma:
> can anybody tell me how to create csv file in xbase application.
>
> Sudeep Sharma
a very easy way is the same as with clipper:
set console off
set alternate to "myFile.csv"
set alternate on
? "Field1;Field2;Field3"
do while ! eof()
if PrintRecord() your filter
? ... all your fieldnames ...
endif
skip
enddo
Depending what you need !!!
Excel in Germany needs 1,90 not 1.90
Excel use ";" instead of "," between fields
Strings should be in " ... "
Maybe you don't want to have
CRLF inside a variable ?
how to print date fields ...
so I would make a function to handle
the data fields as you need, like
function PrintValCSV(cVar)
default cVar to ""
do case
case valtype(cVar)="C"
cVar := '"'+cVar+'"' alltrim() ?
case valtype(cVar)="N" with or without dec ?
cVar := str(cVar) Translate() ?
cVar := StrTran(cVar,",",cDelim) "." => ","
case valtype(cVar)="D"
cVar := dtos(cVar) or iso or ???
endcase
return cVar