Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to block 1 field from APPEND FROM
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00389759
Message ID:
00390462
Vues:
17
>>>Hi Carl,
>>>
>>>>I am trying to append data from various files of varioius formats. for now: dbf, txt, cvs and txt.
>>>
>>>Just curious...whats a cvs file?
>>>
>>
>>I'd suspect a CSV - Comma Separated Values, andled by APPEND FROM...DELIMITED
>
>Better yet, APPEND FROM (LCFILNAM) TYPE CSV
>
>The first line of a CSV file is a list of field names - don't want that getting appended into the table. I think VFP just ignores them and puts the first field of the file into the first field of the table regardless of the field names - seams like a VFP bug to me, but the docs don't really say anyting.
>
>>
>>...
>>
>>Rather than this, export the structure of the table either to an array (using AFIELDS) or COPY STRUCTURE EXTENDED, remove the PKAD entry (using AFIELDS, do an ADEL and redimension the array, or COPY STRUCTURE EXTENDED, delete the data row defining PKAD from the strucxture file) and create an intermediary file based on the revised definition which would be used to import the data. You would then add the data from the intermediary file to add imported record; several approaches to adding the data with a value for PKAD could be used based on INSERT INTO, generating the PK and sticking it into the INSERT, or you might try SCATTER TO NAME, doing an AddProperty to the resulting object to add the PKAD member and populate it before using it to GATHER FROM NAME to the live file, or even a straight APPEND FROM if the DBC creates a default unique value on an Append.
>
>Better than ADEL(), check this out:
>
>use attendees
>aFields( laFlds )
>create cursor AdBuff from array laFlds
>alter table AdBuff drop column pkAd
>append from (lcFilNam) type csv
>select attendees
>append from dbf( 'adBuff' )

Breaks if the PKAD field does not assign a unique default value on adding a new record. Same issue whether you use an ADEL to remove the entry before creating the cursor or an ALTER TABLE after creating it, smokes from having duplicate PKAD values if no default assignment takes place when appending into attendees.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform