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

Home

 
4D v19.8
entity.getDataClass( )

entity.getDataClass( ) 


 

entity.getDataClass () -> Result 
Parameter Type   Description
Result  DataClass in DataClass object to which the entity belongs

The entity.getDataClass( ) method returns the dataclass of the entity. This method is useful when writing generic code.

Example  

The following generic code duplicates any entity:

  //duplicate_entity method 
  //duplicate_entities($1)
  //duplicate_entities(entity)
 
 C_OBJECT($1;$entity;$entityNew;$status)
 $entity:=$1 //receive the entity to duplicate in $1
 $entityNew:=$entity.getDataClass().new() //create a new entity in the parent dataclass
 $entityNew.fromObject($entity.toObject()) //get all attributes
 $entityNew[$entity.getDataClass().getInfo().primaryKey]:=Null //reset the primary key
 $status:=$entityNew.save() //save the duplicated entity



See also 

4D Blog - ORDA member methods to get the structure information
entitySelection.getDataClass( )

 
PROPERTIES 

Product: 4D
Theme: ORDA - Entity

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R5

 
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)