company logo

SDB_Attribute - Attribute definition

Inherits:  SDB_Property

Attribute definitions are used to define the attributes for a complex data type (structure). Attributes can be defined as transient or persistent attributes. Attributes are persistent by default when being defined in a persistent instance and they are transient, when being defined in a transient instance.

Within a persistent instance, transient attributes can be defined by setting the transient option. Transient attributes must be filled by the application as long as no source has been defined for the attribute. When a source is defined, the attribute is filled, when accessing it (e.g. calling toString() ). This means, that the attribute value is not automatically calculated, when reading the instance.

Attributes of complex data type must not contain relationships to structured instances. Attributes may contain MEMO fields.

Transient attributes

Attributes are transient by default when being defined in a transient instance. Within a persistent instance, transient attributes can be defined by setting the transient option.

Transient attributes might be filled by the application. This is typically done in the instance read handler for the structure containing the transient attribute.

A more simple way is defining a source expression for the transient attribute. When a source is being defined, the attribute is filled, when accessing it (e.g. Property::string() ). This means, that the attribute value is not automatically calculated, when reading the instance, but only, when explicitly required.

Array attributes

Array attributes can be defined by setting a dimension value greater than 1. Attribute arrays can be checked by calling Property::isArray() (do not call Property::isCollection() since arrays are not treated as collections).

Attribute arrays can be accessed as soon as the structure instance containing the array is selected or positioned. Array elements can be accessed by assigning an array index ( Property::get(iPosition) ) or using the selection operator in an access path ( Persons('Miller'). firstnames(0) ).

Accessing an array with an index higher than the dimension value for the array will throw an error.

Keys
Functions