The Record Number command and the Selected Record Number command return the record number and the selected record number respectively associated with a record, but what’s the difference between the two? The record number is the physical record number for a record, while the selected record number is the position of the record in the current selection. The record number remains the same for a record until it is deleted or the file is reordered using 4D Tools. The selected record number, on the other hand, assigned to the record, depends on the current selection and can change when the selection is changed or sorted. Moreover, the record number automatically assigned to a record starts at 0, while the selected record number starts at 1. Below is an example to illustrate the difference:
The following data are entered in the following order: Golf, Echo, Alpha, Charlie and are displayed after executing the ALL RECORDS command.
Data Record Number Selected Record Number
Golf 0 1
Echo 1 2
Alpha 2 3
Charlie 3 4
But after sorting the records alphabetically:
Data Record Number Selected Record Number
Alpha 2 1
Charlie 3 2
Echo 1 3
Golf 0 4
The Record Number remains the same but the Selected Record Number assigned to a record has now changed.