Command APPEND BLANK Foundation

Creates a new record in the current work area or an specified workarea.

Syntax
APPEND [BLANK] [IN <nWorkArea> | <cAlias> ] [NOMENU]
Parameters
IN <nWorkArea>
<nWorkArea> is a positive integer specifying the ordinal number of the work area being selected.
IN <cAlias>
This argument is either a literal alias name or a character expression containing the alias name in parentheses. The alias name indicates the work area whose files are to be closed.
NOMENU
This command option is ignored in Xbase++ 2.0
Description

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.

Examples
APPEND BLANK
// 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 
Feedback

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.