Editar

Compartir vía


RecordRef.DeleteLink(Integer) Method

Version: Available or changed with runtime version 1.0.

Deletes a specified link from a record in a table.

Syntax

 RecordRef.DeleteLink(ID: Integer)

Parameters

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

ID
 Type: Integer
The ID of the link you want to delete.

Remarks

When you add a link to a page or a table, an entry is created in the Record Link system table. Each entry is given an ID. This ID is specified as a parameter in the DeleteLINK method.

Example

The following example deletes a link 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 DeleteLINK method deletes the link that is specified in the varLinkid variable. A message that states that the link is deleted is displayed in a message box. You can verify that the link is deleted in the Links FactBox on the Customer List or Customer Card pages.

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

RecordRef Data Type
Get Started with AL
Developing Extensions