Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append From Must have CRLF
Message
From
01/06/2003 00:21:53
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
31/05/2003 23:40:29
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00794926
Message ID:
00794958
Views:
18
>>>Unfortunately the way these files are designed there are both carriage returns and linefeeds embedded in the row.
>>>
>>>It is an SDF file of variable length but always has a carriage return followed by a line feed at the end of each line.
>>>
>>>Is there a way to deal with this?
>>
>>CR+LF is the standard end-of-line symbol in the DOS/Windows world.
>>
>>APPEND FROM, or IMPORT, should deal with this correctly.
>
>
>Create table testimport ( testfield Chr(10) )
>StrToFile( 'a' + Chr(13) + Chr(10) + 'b' + Chr(13) + 'c' + Chr(13) + 'd' + ;
> Chr(10 ), "test.txt" )
>Append From test.txt type sdf
>
>
>
>I'm getting 4 records.

Oh, I see. You want to avoid a single chr(13) or chr(10) starting a new line. I had misunderstood this.

Yes, VFP accepts both a single chr(13) and a single chr(10) as a line-break - at least, in some cases.

One way to solve this is to replace the single chr(13) and chr(10) by other symbols, before and after, something like this:
MyFile = FileToStr("Import.txt")
MyFile = strtran(MyFile, chr(13) + chr(10), "<<NEWLINE>>"))
MyFile = strtran(MyFile, chr(13), "<<chr(13)>>")
MyFile = strtran(MyFile, chr(10), "<<chr(10)>>")
MyFile = strtran(MyFile, "<<NEWLINE>>", chr(13) + chr(10))
StrToFile(MyFile, "Import.txt")
* Do the import here
* Replace "<<chr(13)>>" with chr(13) in relevant fields
* Replace "<<chr(10)>>" with chr(10) in relevant fields
You could also importing through LLFF. I am not sure, right now, how "end-of-line" is interpreted in this case.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform