RecordRef.SetTable(Record) Method

Version: Available or changed with runtime version 1.0.

Sets the table to which a Record variable refers as the same table as a RecordRef variable.

Syntax

 RecordRef.SetTable(Rec: Record)

Parameters

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

Rec
 Type: Record
Specifies the Record that you want to refer to the table.

Remarks

Any filters that are applied to the RecordRef are also applied to the Record. If you change the filter that is applied to the RecordRef, you must call SetTable again to apply the new filter to the Record.

Example

This example shows that if you have a RecordID data type, you can get a RecordRef for the table that the RecordID refers to. Then you can use the RecordRef to set the table to which a Record variable refers.

var
    RecRef: RecordRef;
    InvtEventBuf: Record "Inventory Event Buffer";
    RecID: RecordId;
    ProdOrderComp: Record "Prod. Order Component";
begin 
    InvtEventBuf.Find('-');  
    RecID := InvtEventBuf."Source Line ID";  
    RecRef := RecID.GetRecord;  
    RecRef.SetTable(ProdOrderComp);  
end;

See Also

RecordRef Data Type
Get Started with AL
Developing Extensions