Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASCII comma-delimited import...
Message
 
To
17/10/1996 11:09:35
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00010321
Message ID:
00010758
Views:
27
Robert,

If you have an option (probably you don't), I've had much better luck
with importing SDF files rather than delimited ASCII. In case you're
not familiar with SDF, it's just 'fixed row' ASCII like this

FIELD1.... FIELD2.... FIELD3....

where field1 is always the same width as is field2, field3, etc. It works great with CREATE CURSOR / APPEND FROM ... SDF. If you're not already using create cursor you should try it out as it really speeds up the import process.

If you're stuck with delimited ascii, the only really workable way that I have found is to take your source program (Excel, for example), replace
all the comma characters with something strange (like the tilde ~ character) and all the quotes with an equally obscure character like the caret ^ character. Then do your import and then scan what you just
imported to replace everything back to the original condition. This is somewhat of a pain and is impossible with some programs because you can't search and replace.

The third solution is to create a temporary cursor (or database) that has only one field that is wide enough to handle your longest line. Append into the database and then set up a scan loop to handle the post-processing. You end up having to break apart the fields yourself, but it's really easy to write a UDF to do this. You can add a check to discard breaks that occur in the middle of strings where you have a letter-quote-letter combination or a letter-comma combination so that only the real breaks are processed.

Hope this helps...

Michael
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform