sdaiCreateNestedAggr


Creates an aggregate instance and sets the created aggregate as an element in an already existing aggregate instance, i.e., a nested aggregate is the result of this operation. The already existing aggregate will be the parent aggregate of the new created aggregate and the new created aggregate will be a child aggregate of the already existing aggregate. Any levels of nesting is legal provided that the levels of nesting is according to the actual attribute declaration of the attribute that owns the outer-most aggregate, i.e., the aggregate created by the sdaiCreateAggr or sdaiCreateAggrBN operation. The actual aggregate type to be created is defined by the attributed declaration in the related EXPRESS schema.
This operation is legal for LIST, SET, and BAG aggregates. When this operation is applied on a LIST aggregate, the new created aggregate will be inserted as the last element in the actual LIST, i.e. it behaves as an append operation on the LIST.
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.
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 aggregates owned by 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 , sdaiCreateAggrBN , sdaiCreateNestedAggrByIndex , sdaiCreateNestedAggrByIterator , edmiCreateTypedAggr , edmiCreateTypedAggrBN , edmiCreateNestedTypedAggr , edmiCreateNestedTypedAggrByIndex , edmiCreateNestedTypedAggrByIterator , edmiCreateScratchAggr , edmiCreateNestedScratchAggr , edmiCreateSubtypeAggr , edmiCreateSubtypeAggrBN , edmiCreateUnionAggr , edmiCreateUnionAggrBN
Header:
#include "sdai.h"
Prototype:
SdaiAggr sdaiCreateNestedAggr(SdaiAggr aggregate);
Arguments:

aggregate

A numeric aggregateID that uniquely identifies an aggregate instance in the EDMdatabase. This aggregate becomes the parent aggregate of the new created aggregate. The parent aggregate must be a LIST, BAG, or SET aggregate. The new created aggregate will be inserted as an element in the aggregate specified by this argument.
The aggregateID is returned when the aggregate is created or it can be retrieved by an _EDMinterface_ get operation.

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 anInst;
SdaiAggr parentAggr, aggrId;
...
parentAggr = SdaiCreateAttrBN(anInst, "Attr");
. . .
aggrId = sdaiCreateNestedAggr(parentAggr);
if (! aggrId) {
/* Error in operation */ 
printf("\nError: %s in sdaiCreateNestedAggr \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 
}
. . .