Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transfering a memo field to an ASCII file
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00558734
Message ID:
00559097
Views:
15
>Hello all,
>
>Does anyone know if it is possible to create a comma delimited ASCII file from a Visual FoxPro 6.0 table with memo fields?
>
>The COPY TO command will not transfer memo fields and when I try to use FWRITE(), any carriage returns or line feeds cause the data to write to several lines.
>
>Any ideas?
>
>Thanks.
>
>Chris

You can use set alte to and ?? to do this as follows:

*-------------------------------------------
#define CRLF chr(13)+chr(10)
set alte to temp.txt
set alte on
scan
?? qt(field1)+qt(field2)+qt(field3,.f.)+CRLF
endscan
set alte to

*-------------------------------------------
function qt(fld, noComma)
* Function to add quotes and comma by default.
* If second param present then comma is ommited
comma=iif(parameters()=1,",","")
return ["]+TRIM(STRTRAN(fld, CRLF, " "))+["]+comma
*-------------------------------------------

This will print both character and memo fields. For numerics and other types you must convert to character.

Costas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform