sdaiCreateAggrBN
Creates an empty aggregate instance and connects the created aggregate to the specified attribute of 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 attributed 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 .
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: sdaiCreateAggr, sdaiCreateNestedAggr , sdaiCreateNestedAggrByIndex , sdaiCreateNestedAggrByIterator , edmiCreateTypedAggr , edmiCreateTypedAggrBN , edmiCreateNestedTypedAggr , edmiCreateNestedTypedAggrByIndex , edmiCreateNestedTypedAggrByIterator , edmiCreateScratchAggr , edmiCreateNestedScratchAggr , edmiCreateSubtypeAggr , edmiCreateSubtypeAggrBN , edmiCreateUnionAggr , edmiCreateUnionAggrBN
Header:
#include "sdai.h"
Prototype:
SdaiAggr sdaiCreateAggrBN(SdaiAppInstance appInstance,
SdaiString attributeName);
Arguments:
appInstance |
A numeric instanceID that uniquely identifies an application instance in the EDMdatabase. This instanceID is returned when the actual instance is created by the sdaiCreateInstance or sdaiCreateInstanceBN operations. |
attributeName |
Name of the attribute that will be the owner of the created aggregate. Attribute names are case insensitive. The attributeName must be qualified with the ENTITY name when the attribute name is not unique within the Entity. |
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;
SdaiAggr aggrId;
...
aggrId = sdaiCreateAggrBN(appInstance, "Children");
if (! aggrId) {
/* Error in operation */
printf("\nError: %s in sdaiCreateAggrBN \n",
edmiGetErrorText(sdaiErrorQuery()));
goto error;
}
. . .