4D v19

entity.getDataClass( )

Home

 
4D v19
entity.getDataClass( )

entity.getDataClass( )  


 

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 

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)