4D v14.3ADD RECORD |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
ADD RECORD
ADD RECORD
The ADD RECORD command lets the user add a new record to the database for the table aTable or for the default table, if you omit the aTable parameter. ADD RECORD creates a new record, makes the new record the current record for the current process, and displays the current input form. In the Application environment, after the user has accepted the new record, the new record is the only record in the current selection. The following figure shows a typical data entry form. The form is displayed in the frontmost window of the process. The window has scroll bars and a size box. Specifying the optional * parameter causes the window to be drawn without scroll bars or a size box. ADD RECORD displays the form until the user accepts or cancels the record. If the user is adding several records, the command must be executed once for each new record. The record is saved (accepted) if the user clicks an Accept button or presses the Enter key (numeric keypad), or if the ACCEPT command is executed. The record is not saved (canceled) if the user clicks a Cancel button or presses the cancel key combination (Ctrl-Period on Windows, Command-Period on Macintosh), or if the CANCEL command is executed. After a call to ADD RECORD, OK is set to 1 if the record is accepted, to 0 if canceled. Note: Even when canceled, the record remains in memory and can be saved if SAVE RECORD is executed before the current record pointer is changed. The following example is a loop commonly used to add new records to a database: FORM SET INPUT([Customers];"Std Input") ` Set input form for [Customers] table The following example queries the database for a customer. Depending on the results of the search, one of two things may happen. If no customer is found, then the user is allowed to add a new customer with ADD RECORD. If at least one customer is found, the user is presented with the first record found, which can be modified with MODIFY RECORD: READ WRITE([Customers]) Accepting the record sets the OK system variable to 1; canceling it sets the OK system variable to 0. The OK system variable is set only after the record is accepted or canceled. |
PROPERTIES
Product: 4D
HISTORY
Created: < 4D v6 SEE ALSO
ACCEPT ARTICLE USAGE
4D Language Reference ( 4D v12.4) Inherited from : ADD RECORD ( 4D v11 SQL Release 6) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||