4D v19

entity.touchedAttributes( )

Accueil

 
4D v19
entity.touchedAttributes( )

entity.touchedAttributes( )  


 

La méthode entity.touchedAttributes( ) retourne les noms des attributs qui ont été modifiés depuis que l'entité a été chargée en mémoire.

Cette fonction est applicable aux attributs de type storage ou relatedEntity (voir dataClassAttribute.kind).

Dans le cas d'un attribut relationnel ayant été "touché" (i.e., la clé étrangère), le nom de l'entité liée et celui de sa clé primaire sont retournés.

Si aucun attribut de l'entité n'a été touché, la méthode retourne une collection vide.

 C_COLLECTION($touchedAttributes)
 C_OBJECT($emp)
 
 $touchedAttributes:=New collection
 $emp:=ds.Employee.get(725)
 $emp.firstName:=$emp.firstName //Même modifié avec la même valeur, l'attribut est considéré comme touché
 $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"]

Dans ce cas :

  • le "kind" de firstName et lastName est storage
  • le "kind" de employer est relatedEntity
  • employerID est la clé étrangère de l'entité liée employer.



Voir aussi  

entity.touched( )

 
PROPRIÉTÉS 

Produit : 4D
Thème : ORDA - Entity

 
PAGE CONTENTS 
 
HISTORIQUE 

 
UTILISATION DE L'ARTICLE

4D - Langage ( 4D v19)
4D - Langage ( 4D v19.1)