4D v18

entity.touchedAttributes( )

Home

 
4D v18
entity.touchedAttributes( )

entity.touchedAttributes( )  


 

The entity.touchedAttributes( ) method returns the names of the attributes that have been modified since the entity was loaded into memory.

This applies for attributes of the type storage or relatedEntity (see dataClassAttribute.kind).

In the case of a related entity having been touched (i.e., the foreign key), the name of the related entity and its primary key's name are returned.

If no entity attribute has been touched, the method returns an empty collection.

 C_COLLECTION($touchedAttributes)
 C_OBJECT($emp)
 
 $touchedAttributes:=New collection
 $emp:=ds.Employee.get(725)
 $emp.firstName:=$emp.firstName //Even if updated with the same value, the attribute is marked as touched
 $emp.lastName:="Martin"
 $touchedAttributes:=$emp.touchedAttributes()
  //$touchedAttributes: ["firstName","lastName"]

 C_COLLECTION($touchedAttributes)
 C_OBJECT($emp;$company)
 
 $touchedAttributes:=New collection
 
 $emp:=ds.Employee.get(672)
 $emp.firstName:=$emp.firstName
 $emp.lastName:="Martin"
 
 $company:=ds.Company.get(121)
 $emp.employer:=$company
 
 $touchedAttributes:=$emp.touchedAttributes()
 
  //collection $touchedAttributes: ["firstName","lastName","employer","employerID"]

In this case:

  • firstName and lastName have a storage kind
  • employer has a relatedEntity kind
  • employerID is the foreign key of the employer related entity



See also 

entity.touched( )

 
PROPERTIES 

Product: 4D
Theme: ORDA - Entity

 
PAGE CONTENTS 
 
HISTORY 

 
ARTICLE USAGE

4D Language Reference ( 4D v18)