This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entity.getKey( )
|
entity.getKey ( {mode} ) -> Result | ||||||||
Parameter | Type | Description | ||||||
mode | Longint |
![]() |
dk key as string: primary key is returned as a string, no matter the primary key type | |||||
Result | Text, Longint |
![]() |
Value of the primary key of the entity | |||||
The entity.getKey( ) method returns the primary key value of the entity.
Primary keys can be numbers (longint) or strings. You can "force" the returned primary key value to be a string, no matter the actual primary key type, by passing the dk key as string option in the mode parameter.
C_OBJECT($employees;$employee)
$employees:=ds.Employee.query("lastName=:1";"Smith")
$employee:=$employees[0]
ALERT("The primary key is "+$employee.getKey(dk key as string))
Product: 4D
Theme: ORDA - Entity
Created: 4D v17
4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)