Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delimited text output without quotes?
Message
From
18/11/1999 23:17:47
Dennis Schuette
Customized Business Services, Llc
Yuma, Arizona, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00292190
Message ID:
00292890
Views:
17
>How can you create a comma-delimited text file without the double quote characters around text fields in VFP6?
>
>I need to create a csv file for use with another application that requires comma separated values, but won't accept the character fields in quotes. I have tried every combination of COPY TO DELIMITED WITH CHARACTER and variations I could think of based on VFP6 Help and the Hacker's Guide entry.
>
>
COPY TO file.txt TYPE DELIMITED WITH BLANK
writes a file having quotes around each text field, separated by a blank space (Contrary to the Hacker's Guide).
>
>
COPY TO file.txt TYPE DELIMITED WITH BLANK WITH CHARACTER ,
generates a syntax error, while
>
>
COPY TO file.txt TYPE DELIMITED WITH ~ WITH CHARACTER ,
creates the file having text fields enclosed in ~ and separated by commas.
>
>This is driving me nuts. (short trip.) Anyone have any solutions?
>
>Thanks,
>Neil Preston

The way I do this is I create a cursor with a field wide enough to handle the data. Then I build this field to mimic the desired output.
For example:

create cursor temp (cDat C(40))
use table1 && structure: field1 N(8,2),field2 C(10),field3 D
scan
insert into temp (cDat) values ;
ltrim(str(table1.field1,8,2)) + ','+ ;
alltrim(table1.field2) + ','+ ;
dtos(field3)
endscan
select temp
copy to temp.txt type SDF fields cDat

*******************
The bonus is that during the scan you can build the data any way you like it.

Denis
Dennis Schuette
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform