sdaiCreateAggr


Creates an empty aggregate instance and connects the created aggregate to the specified attribute in the specified instance.
A numeric aggregateID that uniquely identifies the new created aggregate instance in the EDMdatabase will be the returned function value. This aggregateID should be used to identify this particular aggregate instance in subsequent EDMinterface operations. An aggregateID is persistent and fixed, i.e. it is constant throughout the lifetime of the actual aggregate instance.
The actual aggregate type to be created is defined by the attribute declaration in the related EXPRESS schema. If the actual attribute domain is a nested aggregate, only the first level, i.e., the outer-most aggregate is created. The other levels must be created by one of the following functions: sdaiCreateNestedAggr , sdaiCreateNestedAggrByIndex , or sdaiCreateNestedAggrByIterator .
The actual attribute that will own the new created aggregate is specified by a numeric attributeID that uniquely identifies an attribute definition instance in the EDMdatabase. If the actual attribute already owns an aggregate, the existing aggregate will be deleted before a new one is created by this function.
An aggregateID can never be used as a data value in any of the _EDMinterface_ put operations, it can only be returned as data value in _EDMinterface_ get operations.
This operation is only applicable to Explicit attributes in application instances.
The model that will hold the new created aggregate must be open for write access before this function can be successfully performed.
See related function: sdaiCreateAggrBN , sdaiCreateNestedAggr , sdaiCreateNestedAggrByIndex , sdaiCreateNestedAggrByIterator , edmiCreateTypedAggr , edmiCreateTypedAggrBN , edmiCreateNestedTypedAggr , edmiCreateNestedTypedAggrByIndex , edmiCreateNestedTypedAggrByIterator , edmiCreateScratchAggr , edmiCreateNestedScratchAggr , edmiCreateSubtypeAggr , edmiCreateSubtypeAggrBN , edmiCreateUnionAggr , edmiCreateUnionAggrBN
Header:
#include "sdai.h"
Prototype:
SdaiAggr sdaiCreateAggr(SdaiAppInstance  appInstance,
                         SdaiAttr         attribute); 
Arguments:

appInstance

A numeric instanceID that uniquely identifies an application instance in the EDMdatabase. This instanceID is defined when the actual instance is created by the sdaiCreateInstance or sdaiCreateInstanceBN operation.

attribute

A numeric attributerID that uniquely identifies an attribute definition instance in a dictionary model in the EDMdatabase.
The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions.

Returns:
A numeric aggregateID that uniquely identifies the new created aggregate instance in the EDMdatabase.
aggregateID != 0 : operation successfully performed.
aggregateID = 0 : operation failed, use sdaiErrorQuery function to get error reason.
Example:
SdaiAppInstance appInstance;
SdaiAttr attribute;
SdaiAggr aggrId;
...
aggrId = sdaiCreateAggr(appInstance, attribute);
if (! aggrId) {
/* Error in operation */ 
printf("\nError: %s in sdaiCreateAggr \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 
}
. . .