4D v14.3

ADD SUBRECORD

Home

 
4D v14.3
ADD SUBRECORD

ADD SUBRECORD 


 

ADD SUBRECORD ( subtable ; form {; *} ) 
subtable  Subtable in Subtable to use for data entry
form  String in Form to use for data entry
in Hide scroll bars

Subtables are no longer supported starting with version 11 of 4D. A compatibility mechanism ensures the functioning of this command in converted databases; however, it is strongly recommended to replace any subtables with standard related tables.

The ADD SUBRECORD command adds a new subrecord to subtable, using the form form. ADD SUBRECORD creates a new subrecord in memory, makes it the current subrecord, and displays form. A current record for the parent table must exist. If a current parent record does not exist for the process, ADD SUBRECORD has no effect. The form must belong to subtable.

The subrecord is kept in memory (accepted) if the user clicks an Accept button or presses the Enter key (numeric pad), or if the ACCEPT command is executed. After the subrecord has been added, the parent record must be explicitly saved in order for the subrecord to be saved.

The subrecord is not saved 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 SUBRECORD, OK is set to 1 if the subrecord is accepted, to 0 if canceled.

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.

Example  

The following example is part of a method. It adds a subrecord for a new child to an employee’s record. The data for the children is stored in a subtable named [Employees]Children. Note that the [Employees] record must be saved in order for the new subrecord to be saved:

 ADD SUBRECORD([Employees]Children;"Add Child")
 If(OK=1) ` If the user accepted the subrecord
    SAVE RECORD([Employees]` save the employee’s record
 End if

Accepting the subrecord sets the OK system variable to 1; canceling it sets the OK system variable to 0.

 
PROPERTIES 

Product: 4D
Theme: Data Entry
Number: 202

This command is deprecated and should not be used anymoreThe OK variable is changed by the commandNot for server

 
HISTORY 

Modified: 4D v11 SQL

 
SEE ALSO 

ACCEPT
CANCEL
CREATE SUBRECORD
DELETE SUBRECORD
MODIFY SUBRECORD
SAVE RECORD

 
ARTICLE USAGE

4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)