Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to block 1 field from APPEND FROM
Message
De
08/07/2000 06:05:33
 
 
À
08/07/2000 00:35:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00389759
Message ID:
00389811
Vues:
15
>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

>>
>>I want to block my primary key field from the fields being appended. I have a default set for it, and that is what I want to assign pk's. the rest of the fields (name, addr...) I want to append from.
>>
>>If the source is dbf, I don't know what fields will and won't be there, so I can't just list out all the fields in the destination table (less the pk), because they may not exist in the source.
>
>If you are appending from another table and a field in the destination table isnt present in the source table, it's value is left default. So if Source.dbf has field1 and field2, while Destination.dbf has field1,field2,&field3. Issuing APPEND FROM Source FIELDS field1,field2,field3 will work perfectly fine even though field2 isnt present in the source.dbf.
>
>>
>>I have tried using
>>SET FIELDS TO ALL EXCEPT PKAD
>>
>>but the APPEND FROM command seams to ignore it.
>>
>>APPEND FROM (LCFILNAM) FIELDS ALL EXCEPT PKAD
>
>Try APPEND FROM (LCFILNAM) FIELDS EXCEPT PKAD
>

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.
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