4D v19

entitySelection.getDataClass( )

Home

 
4D v19
entitySelection.getDataClass( )

entitySelection.getDataClass( )  


 

The entitySelection.getDataClass( ) method returns the dataclass of the entity selection. This method is mainly useful in the context of generic code.

Example  

The following generic code duplicates all entities of the entity selection:

  //duplicate_entities method
  //duplicate_entities($1)
  //duplicate_entities(entity_selection)
 
 C_OBJECT($dataClass;$1;$entitySelection;$entity;$duplicate;$status)
 $entitySelection:=$1
 $dataClass:=$entitySelection.getDataClass()
 For each($entity;$entitySelection)
    $duplicate:=$dataClass.new()
    $duplicate.fromObject($entity.toObject())
    $duplicate[$dataClass.getInfo().primaryKey]:=Null //reset the primary key
    $status:=$duplicate.save()
 End for each



See also 

4D Blog - ORDA member methods to get the structure information
dataClass.getDataStore( )
dataClass.getInfo( )
entity.getDataClass( )

 
PROPERTIES 

Product: 4D
Theme: ORDA - EntitySelection

 
PAGE CONTENTS 
 
HISTORY 

 
ARTICLE USAGE

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