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

Home

 
4D v19.8
entity.{attributeName}

entity.{attributeName} 


 

entity.{attributeName} -> entity.<attributeName> 
Parameter Type   Description
entity.<attributeName>  Mixed in Current value of the attribute in the entity

Any dataclass attribute is available as a property of an entity, which stores the attribute value for the entity.

Note: Dataclass attributes can also be reached using the alternate syntax with [ ].

The attribute value type depends on the attribute kind (relation or storage):

  • If attributeName kind is storage:
    entity.attributeName returns a value of the same type as attributeName.
  • If attributeName kind is relatedEntity:
    entity.attributeName returns the related entity. Values of the related entity are directly available through cascading properties, for example "myEntity.employer.employees[0].lastname".
  • If attributeName kind is relatedEntities:
    entity.attributeName returns a new entity selection of related entities. Duplications are removed (an unordered entity selection is returned).

Note: For more information on attribute kinds, please refer to the dataClassAttribute.kind property description.

Example  

 C_OBJECT($myEntity)
 $myEntity:=ds.Employee.new() //Create a new object of the entity type
 $myEntity.name:="Dupont" // assign 'Dupont' to the 'name' attribute
 $myEntity.firstname:="John" //assign 'John' to the 'firstname' attribute
 $myEntity.save() //save the entity



See also 

entitySelection.{attributeName}

 
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)