4D v14.3

Record number

Home

 
4D v14.3
Record number

Record number 


 

Record number {( aTable )} -> Function result 
Parameter Type   Description
aTable  Table in Table for which to return the number of the current record, or Default table, if omitted
Function result  Longint in Current record number

Record number returns the physical record number for the current record of aTable. If there is no current record, such as when the record pointer is before or after the current selection, Record number returns –1. If the record is a new record that has not been saved, Record number returns –3.

Record numbers can change. The record numbers of deleted records are reused.

4D Server: This command returns a different result for the On Validate form event depending on whether it is executed on 4D in local mode or 4D in remote mode. In local mode, the command returns a record number (the record is considered as already created). In remote mode, the command returns -3 because, in this case, the record is already created on the server but the information has not yet been sent to the client.

Note: It is recommended to use the Is new record command to check whether a record is in the process of being created.

Example  

The following example saves the current record number and then searches for any other records that have the same data:

 $RecNum:=Record number([People]` Get the record number
 QUERY([People];[People]Last =[People]Last` Anyone else with the last name?
  ` Display an alert with the number of people with the same last name
 ALERT("There are "+String(Records in selection([People])+" with that name.")
 GOTO RECORD([People];$RecNum` Go back to the same record

 
PROPERTIES 

Product: 4D
Theme: Records
Number: 243

Different in remote mode

 
HISTORY 

Created: < 4D v6

 
SEE ALSO 

About Record Numbers
GOTO RECORD
Is new record
Selected record number
Sequence number

 
ARTICLE USAGE

4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)