Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transfering a memo field to an ASCII file
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00558734
Message ID:
00559097
Vues:
14
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform