4D v14.3APPLY TO SELECTION |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
APPLY TO SELECTION
APPLY TO SELECTION
APPLY TO SELECTION applies statement to each record in the current selection of aTable. The statement can be a statement or a method. If statement modifies a record of aTable, the modified record is saved. If statement does not modify a record, the record is not saved. If the current selection is empty, APPLY TO SELECTION has no effect. If the relation is automatic, the statement can contain a field from a related table. APPLY TO SELECTION can be used to gather information from the selection of records (for example, a total), or to modify a selection (for example, changing the first letter of a field to uppercase). If this command is used within a transaction, all changes can be undone if the transaction is canceled. 4D Server: The server does not execute any of the commands that may be passed in statement. Every record in the selection will be sent back to the local workstation to be modified. The progress thermometer is displayed while APPLY TO SELECTION is executing. To hide it, use MESSAGES OFF prior to the call to APPLY TO SELECTION. If the progress thermometer is displayed, the user can cancel the operation. The following example changes all the names in the table [Employees] to uppercase: APPLY TO SELECTION([Employees];[Employees]Last Name:=Uppercase([Employees]Last Name)) If a record is locked during execution of APPLY TO SELECTION and that record is modified, the record will not be saved. Any locked records that are encountered are put in a set called LockedSet. After APPLY TO SELECTION has executed, test LockedSet to see if any records were locked. The following loop will execute until all records have been modified: Repeat This example uses a method: ALL RECORDS([Employees]) If the user clicks the Stop button in the progress thermometer, the OK system variable is set to 0. Otherwise, the OK system variable is set to 1. |
PROPERTIES
Product: 4D
HISTORY
Modified: 4D v11 SQL SEE ALSO ARTICLE USAGE
4D Language Reference ( 4D v12.4) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||