Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing a csv file programmatically
Message
De
24/01/1999 16:26:16
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00179381
Message ID:
00179630
Vues:
23
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform