Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing a csv file programmatically
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00179381
Message ID:
00179919
Vues:
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.

This is something I didn't get from your original question. The layout of the file you're getting a) may change from file to file, b) may change from row to row within the file? If that's the case, you'll have to do something like you're saying, look at each file, line by line, to determine the max field sizes.

But I would think you'd be able to get spec's from the person sending you the file, that the max. size of each field will always be xxx, and you can make a table big enough to accommodate that max before the first append, and be done. Or maybe even you should be able to tell them how to format a file if they want to send it to you.

In data communication of this type, it's definitely the norm to make fairly strict requirements for the format of file you'll accept. Your user(s) shouldn't find this unusual.

HTH,
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform