RecordRef.DeleteLinks() Method

Version: Available or changed with runtime version 1.0.

Deletes all of the links that have been added to a record.

Syntax

 RecordRef.DeleteLinks()

Parameters

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

Example

The following example deletes all links from a customer record in the Customer table. The code starts by opening table 18 (Customer) as a RecordRef variable that is named CustomerRecref. The Field Method (RecordRef) creates a FieldRef variable that is named MyFieldRef for the first field in the table (No.). MyFieldRef.Value selects record 01121212 from the No. field. This record is initialized in the CustomerNum variable. The Find Method (RecordRef) searches for record 01121212. If the record is found, the DeleteLINKS method deletes all the links in the record. A message that states that the links are deleted is displayed in a message box. You can verify that the links are deleted in the Links FactBox on the Customer List or Customer Card pages.

var
    MyFieldRef: FieldRef;
    CustomerRecRef: RecordRef;
    CustomerNUm: Integer;
    Text000: Label 'The link with id %1 is deleted.;
    Text001: Label 'The customer cannot be found.';
begin     
    CustomerNum := '01121212';  
    CustomerRecref.Open(18);  
    MyFieldRef := CustomerRecref.Field(1);  
    MyFieldRef.Value := CustomerNum;  
    if CustomerRecref.Find('=') then begin  
      CustomerRecref.DeleteLinks;  
      Message(Text000, CustomerNum);  
    end else
      Message(Text001);  
end;

RecordRef Data Type
Get Started with AL
Developing Extensions