Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to block 1 field from APPEND FROM
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00389759
Message ID:
00390482
Views:
20
>>>>Hi Carl,
>>>>
>>>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.

The attendees.pkAd field is where the default is defined. The keys will be generated on the APPEND FROM DBF('adBuff'), right?

afields() will pick up the default definition, but because a cursor is not part of a dbc, adBuff won't get it.
Previous
Reply
Map
View

Click here to load this message in the networking platform