Уреди

Делите путем


RecordRef.DeleteAll([Boolean]) Method

Version: Available or changed with runtime version 1.0.

Deletes all records in a table that fall within a specified range.

Syntax

 RecordRef.DeleteAll([RunTrigger: Boolean])

Parameters

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

[Optional] RunTrigger
 Type: Boolean
Specifies whether the code in the OnDelete trigger will be executed. If this parameter is true, the code will be executed. If this parameter is false (default), the code will not be executed. This parameter is optional.

Remarks

This method works the same way as the DeleteAll Method (Record).

Example

The following example opens table 18 (Customer) as a RecordRef variable that is named CustomerRecRef. The Field Method (RecordRef) creates a FieldRef variable that is named MyFieldRef for field 1 (No.). From the No. field, the SetRange Method (FieldRef) selects records in the range from 10000 to 20000. The number of records in the range is displayed in a message box. The DeleteALL method deletes all records in that range. The number of records is displayed again. This time, 0 is displayed because all the records in the range are deleted.

var
    MyFieldRef: FieldRef;
    CustomerRecRef: RecordRef;
    Text000: Label 'The number of records in the range is %1.;
begin 
    CustomerRecRef.Open(18);  
    MyFieldRef := CustomerRecRef.Field(1);  
    MyFieldRef.SetRange('10000' , '20000');  
    Message(Text000 ,CustomerRecRef.Count);  
    CustomerRecRef.DeleteALL;  
    Message(Text000 ,CustomerRecRef.Count);  
end;

RecordRef Data Type
Get Started with AL
Developing Extensions