Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying a VFP6 cursor to a CSV file

Status
Not open for further replies.

foxbldr

Programmer
Apr 16, 2002
109
CA
Hi Everybody,

I create a CSV file using a cursor and this CSV file is used as an input to some other system. When converting to a CSV file, I want cursor's numeric fields with value zero to be written as an empty string to CSV file.
( I used "Copy to ... type csv")

Example:

Cursor
Code Amount
M23 23.25
M22 0.00

CSV
Code Amount
M23 23.25
M22

I defined cursor's fields with NULL clause but,still VFP6 inserts value 0 in CSV file. Any ideas or tricks?

Thank you all in advance.

Foxbldr







 
You could try:
Code:
LOCAL lcFile
lcFile = FILETOSTR("test.csv")
lcFile = STRTRAN(lcFile,'"0.00"','""') && or however 0 is written
STRTOFILE(lcFile,"test.csv")

I havent tested this. Note the single quotes used to delimit.

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top