Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File to str - I need a carriage return
Message
De
15/10/2014 03:05:35
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
15/10/2014 02:54:38
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01609388
Message ID:
01609390
Vues:
34
>>I have created a dbf with a number of records each containing a long memo field with a long string - there are 2 types of records A and B
>>
>>When I convert this to a text file using file to string I need all B records to have a carriage return at the end of that line in the text file
>>
>>How can I do this
>>
>>I don't need a line feed character as well
>>
>>Thanks
>
>This is a bit a to wide question
>assuming you will remember the CRLF discussion of yesterday.
>
>
>SELECT yourTable
>lcx = "" &&initial
>SCAN FOR [expression that filters out record b]
> TEXT to lcx TEXTMERGE NOSHOW ADDITIVE
><<field1>>,sometconstant <<fieldn>>
>
> ENDTEXT
>ENDSCAN
>STRTOFILE(lcx,YourFileName)
>
>*or within the scan anything else that will build the string, we had examples yesterday.
>
>
>other version
>
>SELECT yourTable
>COPY TO YourFileName FOR [expression that filters out record b] TYPE SDF
>*or
>COPY TO YourFileName FOR [expression that filters out record b] TYPE CSV
>
>
>also look for TYPE DELIMITED in the help
>
>or
>
>SELECT;
> Cur1.*;
> FROM YoruTable AS Cur1;
> TO FILE YourFileName;
> WHERE [expression that filters out record b]
>
>
>thats not all possible, but it's a start.
>
>I while sooner or later need to move to some SQL Server anyway. would do something like
>
>*could be replaced for SQL Server w/o changing te cursor
>SELECT;
> Cur1.*;
> FROM YoruTable AS Cur1;
> INTO CurOutPut;
> WHERE [expression that filters out record b]
>
>*this might be in some function that itself coud be replaced and be generic or what ever
>lcx = "" &&initial
>SCAN FOR [expression that filters out record b]
> TEXT to lcx TEXTMERGE NOSHOW ADDITIVE
><<field1>>,sometconstant <<fieldn>>
>
> ENDTEXT
>ENDSCAN
>*or something similar
>
>*final write
>STRTOFILE(lcx,YourFileName)
>
>This gives fine control over the output.
>
>Lutz

Update:
Any LF can be removed from the string with
lcx = chrtran(lcX,'0h0A,''()
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform