Defining keys
Keys might be defined for a complex data type definition for two reasons. On the one hand, keys are used to define sort orders for different collections (extents, references or relationships). On the other hand, one key might be defined as identifying key, which is usually a unique key among all instances of the given complex data type (structure).
When not using the data type wizzard, keys should be defined manually before defining any collection (extent, reference or relationship referring to the key. This allows the system to initialize collections properly. In order to define keys, you select the Keys tab in the definition form.

After entering the new key name, key components have to be added to the component list right of the key list. Key components are attributes defined in the complex data type or inherited from is base types. Attributes defined as key components need not to exist. When not yet existing, they will be added as attributes automatically.
Keys will be inherited to derived data types (specializations). When defining a key with the same name as being defined in the base type, the key will be overloaded in the specialized data type and replaces the key definition from the base type.
A special key is the identity key, which does not have key components but refers to the object instance identity (LOID). The identity key has a fixed name __IDENTITY and has to be defined when collections are to be sorted by identity. The identity key is a save mean in order to create a unique key for a collection, but the value may change, when copying the database. In order to obtain stable key values, the GUID (global unique identifier) or an automatic number should be used
In order to define an automatic number for instances in a collection. Auto-numbering keys do not require specific names, but must consist of a single attribute with the name __AUTOIDENT . In case of collection hierarchies, the auto-number is created for the super-set and not within the context, where an instance is going to be created.

