Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Merging lines in a text file
Message
 
To
06/10/2014 10:39:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01608814
Message ID:
01608854
Views:
29
>>>>>
>>>>>lcx = ''
>>>>>lcDelim = ' '
>>>>>sele one && Field cHeader for the headers
>>>>>scan
>>>>> lcx = lcx+alltr(cHeader)+lcDelim
>>>>>endscan
>>>>>lcx = left(lcx,len(lcx)-len(lcDelim))+0h0D0A
>>>>>
>>>>>sele two
>>>>>scan
>>>>> lcx = lcx+transform(Field1)+lcDelim
>>>>> lcx = lcx+transform(Field2)+lcDelim
>>>>> *..
>>>>> lcx = lcx+transform(Fieldn)+lcDelim
>>>>> lcx = left(lcx,len(lcx)-len(lcDelim))+0h0D0A
>>>>>endscan
>>>>>lcx = left(lcx,len(lcx)-2)
>>>>>
>>>>>strtofile(lcx,'Yourfile.ext')
>>>>>
>>>>>
>>>>>something like this?
>>>>>You can replace TRANSFORM with something mor meaningfull, also remove spaces etc.
>>>>
>>>>Seems to work but every fleld has to be worked on separately because they have differnt lengths and properties - but thanks
>>>
>>>Then instead of transform() you may just do padr(), and you'd only need a list of lengths for each column.
>>>Now if you want to have multiline values, i.e. any wrapping of long values, this will get complicated very fast.
>>
>>How do I denote a carriage return character at the end of each line
>
>0h0D0A is it - the new (relatively, in VFP8 or 9) feature where you can insert a hex constant. Fox introduced this for binaries, but they mix nicely with regular text, as long as the first element in a concatenation is not a binary. 0d is hex 13 - a CR, 0a is hex 10, a LF.

Thanks for all your help
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Reply
Map
View

Click here to load this message in the networking platform