Append an Empty Record to an External Database and Update the Index

$append_dbf index indexfile datafile

This command adds a blank record to a DBF file and adds a matching index record to an NDX file. The index file is assumed to have unique keys and the append will fail if the index entry already exists, even if it points to a record previously marked for deletion. You can follow this command with $update_dbf commands to update the data fields in the empty record added with this command.

The parameters on this command are used as follows:

index specifies the index value to be used for the new record.
indexfile the full pathname of the NDX index file to be updated. See External Database Files for more information.
datafile the full pathname of the DBF file to which the record is to be appended. See External Database Files for more information.

To reference .DBF files which have Clipper or FoxPro indexes, use the datafile parameter to specify a '.DD' file with the same basename as the .DBF file. This .DD file will then contain the name of the index file, and the indexfile parameter must be used to specify the name of the index tag in the specified index file.

Example:

The following example is a fragment of a .IIF file which appends a new record to a file DATA.DBF with index CALL.NDX, using the unique call number as an index. It then updates two fields, answer1 and answer2, in the new record with values from the val1 and val2 variables.

$append_dbf @callno call.ndx data.dbf

$update_dbf @val1 @callno call.ndx data.dbf ANSWER1

$update_dbf @val2 @callno call.ndx data.dbf ANSWER2