Adds a new record to a table using the values stored in automem variables.

Syntax

APPEND AUTOMEM

Description

APPEND AUTOMEM adds a new record to the currently selected table and then replaces the value of fields in the table with the contents of corresponding automem variables. Automem variables are variables that have the same names and data types as the fields in the current table. Automem variables must be private or public; they cannot be local or static. If a field does not have a matching variable, that field is left blank.

APPEND AUTOMEM is used as part of data entry in an older style of dBL programming. In dBASE Plus, controls in data entry forms are dataLinked to fields; there is no need for a set of corresponding variables. APPEND AUTOMEM is also used for programmatically adding records to a table. It is more convenient than using APPEND BLANK and REPLACE.

To use APPEND AUTOMEM to add records to a table, first create a set of automem variables. The USE...AUTOMEM command opens a table and creates the corresponding empty automem variables for that table. CLEAR AUTOMEM creates a set of empty automem variables for the current table or reinitializes existing automem variables to empty values. STORE AUTOMEM copies the values in the current record to automem variables. You may also create the individual variables manually.

When referring to the value of automem variables you need to prefix the name of an automem variable with M-> to distinguish the variable from the corresponding fields, which have the same name. The M-> prefix is not needed during variable assignment; the STORE command and the = and := operators do not work on Xbase fields.

Note: Read-only field type - Autoincrement

Because APPEND AUTOMEM and REPLACE AUTOMEM write values to your table, the contents of the read-only field type, Autoincrement, must be released before using either of these commands. In the following example, the autoincrement field is represented by "myAutoInc":

use table1 in 1

use table2 in 2

select 1     // navigate to record

store automem

release m->myAutoInc 

select 2

append automem

OODML

The Rowset object contains an array of Field objects accessed through its fields property. These Field objects have value properties that may be programmed like variables.