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

Home

 
4D v19.8
entity.clone( )

entity.clone( ) 


 

entity.clone () -> Result 
Parameter Type   Description
Result  Entity in New entity referencing the record

The entity.clone( ) method creates in memory a new entity referencing the same record as the original entity. This method allows you to update entities separately.

Note: Keep in mind that any modifications done to entities will be saved in the referenced record only when the entity.save( ) method is executed.

This method can only be used with entities already saved in the database. It cannot be called on a newly created entity (for which entity.isNew( ) returns True).

Example  

 C_OBJECT($emp;$empCloned)
 $emp:=ds.Employee.get(672)
 $empCloned:=$emp.clone()
 
 $emp.lastName:="Smith" //Updates done on $emp are not done on $empCloned



See also 

dataClass.new( )

 
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)