The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
TABLENO Method (RecordID)
Gets the table number of the table that is identified by RecordID. This method returns an error if the record is blank.
No := RecordID.TABLENO
The RecordID of the record whose number you want returned.
Property Value/Return Value
The number of the table.
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 for Finance and Operations, Business edition instead.
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. This example requires that you create the following global variables.
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;