Modifier

Partager via


RecordId.TableNo() Method

Version: Available or changed with runtime version 1.0.

Gets the table number of the table that is identified by RecordID. This function returns an error if the record is blank.

Syntax

No :=   RecordId.TableNo()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

No
 Type: Integer
The ID of the table.

Remarks

In previous versions of Dynamics 365, if a RecordID referred to a temporary table, then the table number value of the RecordID was the run-time generated sequence ID, which is from the base value of 2000100000. You could use the table number to determine if a RecordID referred to a temporary table. In Dynamics 365, the table number value of a RecordID always contains the ID of the originating physical table and not the run-time generated sequence ID. If you previously used the TableNo Method (RecordID) to test for the sequence number and determine if the RecordID was temporary, then you use the IsTemporary Method (RecordRef) in Dynamics 365 Business Central instead.

Example

The following example opens the Customer table with the record reference variable named RecRef and finds the first record in the Customers table. If a record is found, the RecordId Method (RecordRef) gets the ID of the first record in the table. The TableNo method then uses the RecID variable to retrieve the number of the table that contains the record. The table number is then displayed in a message box.

var
    RecRef: RecordRef;
    RecID: RecordID;
    varTableNumber: Integer;
begin  
    RecRef.Open(Database::Customer);  
    if RecRef.Find('-') then begin  
      RecID := RecRef.RecordId;  
      varTableNumber := RecID.TableNo;  
      Message('The Customer table is number: %1', varTableNumber);  
    end else begin
    Message('No records found in the table');  
    end;  
end;

RecordId Data Type
Get Started with AL
Developing Extensions