4D v18

entity.clone( )

Home

 
4D v18
entity.clone( )

entity.clone( )  


 

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 

 
ARTICLE USAGE

4D Language Reference ( 4D v18)