Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append from ... CSV and Fields clause
Message
De
14/05/2015 10:54:45
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
14/05/2015 10:05:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01619776
Message ID:
01619784
Vues:
45
>>>Hi All,
>>>
>>>When using the APPEND command on a CSV file, does the FIELDS clause represent the names of the columns in the CSV or the DBF?
>>
>>The DBF
>>
>>>
>>>And, does the order in the FIELDS clause represent the order in the CSV or the DBF?
>>
>>The CSV
>>
>>Tamar
>
>My error. The source file is actually a CVS format.
>
>For example: In the destination DBF there is a field named ComPrac_ID. But in the source CVS, it is named Common_Prac_ID.
>
>Also, I am not appending all the fields, but only a select number of the fields.

Then you'll have to create a dummy cursor with the fields you want to skip. The names of fields in the csv are irrelevant - they are ignored (and will probably pollute your table, Fox doesn't have the option to skip the header). So the fields list is not related to fields in the csv, it's to be taken as "first field from csv goes into the first field in the list, 2nd into the 2nd" etc. It's more of "where do csv fields go", not "which scv fields do I want" - you can't pick one and drop another, you can only ignore fields to the right of the last one you listed. If csv has 10 fields and your list has only six, the last four will be ignored.

So if you want to skip some fields, create a cursor with fields named as in the target table, in the order they are in the csv, with placeholder fields (with names not matching any of those in the dbf) for those you want to skip. Append into that cursor, check if you have the header record in it, then append to your dbf from dbf("yourCursorAlias") for ConditionWhichIsTrueExceptForHeaderRecord.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform