Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing a csv file programmatically
Message
From
24/01/1999 16:26:16
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00179381
Message ID:
00179630
Views:
22
>That is the catch. I know that I can use Append From, Copy To, but what do I have to do? Do I have to watch each field for on each iteration and expand the field in the table if the incoming information is larger then the field will accept? You can't do that and use Append From or Copy To. So do I have to read the csv file twice. One scan to find the largest field size required for each field, and the to create a table to hold it, and then again using the Append From command. Seems kind of labor intensive. I would think that there would be an easier way that I am just missing.
>
>What do you guys think?
>
>DJ Hunt :o)

This is exactly what I have done in the past. Depending on the size of the source table, I usually take a sample of it to find the largest field size, and then pad it by a character or two to be safe..

On the other hand, I didn't have the wizard's source code at hand the last time I tackled a task like this. I would dig around a little in there for ideas on how the fox team handled the problem.

Careful though, I had the wizard bite me once because I think it only samples the top 20 rows or so to guess the field size, so using logic liek that can come back and bite you if you have some long values further down in the table.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform