This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
entity.getKey( )

entity.getKey( ) 


 

entity.getKey ( {mode} ) -> Result 
Parameter Type   Description
mode  Longint in dk key as string: primary key is returned as a string, no matter the primary key type
Result  Text, Longint in 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.

Example  

 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))



See also 

dataClass.get( )

 
PROPERTIES 

Product: 4D
Theme: ORDA - Entity

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17

 
ARTICLE USAGE

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)