version 11 (Modified)
APPLY TO SUBSELECTION (subtable; statement)
Parameter | Type | Description | |
subtable | Subtable | Subtable to which to apply the formula | |
statement | Statement | One line of code or a method |
Compatibility note: 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.
Description
APPLY TO SUBSELECTION applies statement to each subrecord in the current subselection of subtable. The statement may be a statement or a method. If the statement modifies a subrecord, the modified subrecord is written to disk only when the parent record is written. If the subselection is empty, APPLY TO SUBSELECTION has no effect.
APPLY TO SUBSELECTION can be used to gather information from the subselection or to modify the subselection.
Example
The following example capitalizes the first names in [People]Children:
ALL SUBRECORDS ([People]Children) APPLY TO SUBSELECTION([People]Children;[People]Children'Name:= Uppercase(Substring([People]Children'Name;1;1)) +Lowercase(Substring([People]Children'Name;2)))
Note: The statement has been put on several lines for clarity in documentation only.
See Also
ALL SUBRECORDS, EDIT FORMULA, QUERY SUBRECORDS, SAVE RECORD.