Command APPEND BLANK Foundation
Creates a new record in the current work area or an specified workarea.
APPEND [BLANK] [IN <nWorkArea> | <cAlias> ] [NOMENU]
The file command APPEND BLANK creates a new empty record at the end of the database open in the current work area or in the workarea specified using the IN clause. The record pointer is positioned at the new (last) record, regardless of current filter or index conditions. The fields of the new record contain empty values of the correct field types.
Multi-user access: When the file is used on a network or from two Xbase++ applications at the same time on the same computer, APPEND BLANK automatically attempts to lock the new record. If the record cannot be locked, nothing is added to the file. This causes a runtime error which is caught by a default error handler. The default error handler sets the value of the function Neterr() to .T. (true) and allows the program to continue.
The functional counterpart of the command APPEND BLANK is the function DbAppend(), which can also create records in another work area using the alias operator.
// In the example, the data for a new record is input
// into memory variables and then an attempt is made to
// create a new record. If it could be created, the
// data in memory variables is copied into the record.
PROCEDURE Main
LOCAL cPartNo := Space(10), cPart := Space(50)
USE Part ALIAS Pt SHARED NEW
IF ! Neterr()
SET INDEX TO PartA, PartB
ENDIF
CLS
@ 10,5 SAY "Part number :" GET cPartNo
@ 11,5 SAY "Part designation:" GET cPart
READ
IF .NOT. Empty( cPtNo + cPart )
APPEND BLANK
IF Neterr()
? "record could not be created"
ELSE
REPLACE pt->PartNo WITH cPartNo , ;
pt->Part WITH cPart
ENDIF
ENDIF
USE
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.