TypeDefinition :: attributeName - Get attribute according to position
The function returns the name of the attribute at position passed in iPosition. The attribute index corresponds to the position of the attribute within the virtual list of all elementary attributes in the type definition. Attributes returned are always attributes of elementary type.
Calling the function by increasing the index recursively will provide all elementary attributes of the structure including those from base structures.
In order to avoid an exception when no more attribute paths are available, attributeNameCount() might be called.
... fragment ( TypeDefinition &td) {
int32 count = td.attributeNameCount();
int32 i = 0;
while ( i < count )
printf(td.attributeName(i++,true,false);
}
MEMO and BLOB fields, even though being defined as references, are considered as attributes, too.
The property name may contain a property path that consists of a sequence of property names. Not allowed are operation paths or path properties, i.e. the property name must consist of identifiers separated by dots (.), only.
In order to pass no property name, an empty string ( String() ) has to be passed.
Implementation details
Attributes in base types or in embedded complex data types (complex attributes) are returned as property paths (e.g. address.city when address is a complex attribute in Person). The leading part for base types (usually the type name) is displayed only when passing true for the bCompletePath option. When false is passed, the minimum path for identifying the attribute will be returned.
Generic attributes can be considered as references or as attributes. The bGeneric option defines whether generic attributes are considered as attributes (true) or not (false).
When an attribute at position passed in iPosition has been found, the function returns the property path to the attribute. Otherwise the function throws an exception.
- iPosition
- Position in collection
The position of an element in a collection is beginning with 0 for the first element.
- bCompletePath
- Complete path
The full path option is used to request the property path including base structure names.
- bGeneric
- Generic attribute option
The option allows considering generic attributes as references.