Editar

Compartir a través de


Record.ModifyAll(Any, Any [, Boolean]) Method

Version: Available or changed with runtime version 1.0.

Modifies a field in all records within a range that you specify.

Syntax

 Record.ModifyAll(Field: Any, NewValue: Any [, RunTrigger: Boolean])

Parameters

Record
 Type: Record
An instance of the Record data type.

Field
 Type: Any
The field that you want to modify.

NewValue
 Type: Any
The value that you want to assign to Field in all records. The data type of NewValue must match the data type of Field.

[Optional] RunTrigger
 Type: Boolean
If this parameter is true, the code in the OnModify Trigger is executed. If this parameter is false (default), the code in the OnModify trigger is not executed.

Remarks

Important

By design, the global variables of the record instance being modified will be initialized to their default value during the ModifyAll method execution, independently of the value that was previously set.

If no filter is set, the field is modified in all records in the table. If a filter is set, the fields are modified only in the records which fall within the range specified by the filter. Records where the field is already equal to the new value are also updated.

The OnValidate field trigger is never run when ModifyAll is used. Using ModifyAll() is recommended if field validation is not wanted or needed. Otherwise, Record.Modify Method can be used.

Example

var
    customerRec: record Customer;

begin
    // The result of this statement:  
    customerRec.ModifyAll("Statistics Group", 2);  
    // is equivalent to:  
    if customerRec.Find('-') then
        repeat  
            customerRec."Statistics Group" := 2;  
            customerRec.Modify;  
        until customerRec.Next = 0;  
end;

Record Data Type
Get Started with AL
Developing Extensions
AL Database Methods and Performance on SQL Server