KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Dataclass Attributes
PRODUCT: 4D | VERSION: 17 R | PLATFORM: Mac & Win
Published On: August 14, 2019

With ORDA in 4D a Dataclass is a model of a Table represented as an Object. The dataclass has an attribute for each of the fields of the specific table and also an attribute for each relation it has.

When the dataclass is created the attributes are listed in ABC order regardless of field number or whether it is a field or a relation with the value being an object of details regarding the field or relation.


For Table_1 above the fields were created in order, the dataclass for it is:


These attributes cannot be assigned to another object or variable and there isn't a way to hide the relations when using the dataclass so if an action must be performed on each field but not the relations it is possible by adding a check to see the "kind" attribute which can either be storage, relatedEntity (N to 1), relatedEntities (1 to N).

Below is an example of a For each statement note that $iterator_t is a Text Type for the property name which is only enumerable :

For each ($iterator_t;$dataclass_Obj)
  If ($dataclass_Obj[$iterator_t].kind="storage")
    // Is a field
  Else
    // Is a relation
  End if
End for each