edmiCreateTypedAggrBN


 

SdaiAggr edmiCreateTypedAggrBN(SdaiAppInstance  currInst,
                                SdaiString       attributeName, 
                                SdaiSelect       pSel); 


Creates an empty typed aggregate instance and connects the created aggregate to the specified attribute in the specified instance. Typed aggregates must be used when the attribute domain in the appropriate Express schema not uniquely defines the aggregate to be created. This can only occur when the actual element specification is of type SELECT.  A struct of type SdaiSelect containing the aggregate typing should be supplied.  A numeric aggregateID that uniquely identifies the new created typed 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 typing information. If the actual aggregate is a nested aggregate, only the first level, i.e., the outer-most aggregate is created.  The actual attribute that will own the new created aggregate is specified by the <attributeName> argument. If the <attributeName> is not unique within the actual instance, the <attributeName> must be qualified with the name of the entity that declares the actual attribute. 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.
 

Arguments


TypeNameComment
SdaiAppInstance

currInst

A numeric instanceID that uniquely identifies an instance in the EDMdatabase that will be the owner instance of the created typed aggregate. This instanceID is defined when the actual instance is created by the sdaiCreateInstance or sdaiCreateInstanceBN operation.

SdaiString

attributeName

Specifies the name of the attribute to be created. Attribute names are case insensitive. When the <attributeName> is not unique within the instance <currInst>, the <attributeName> must be qualified with the name of the entity that declares the actual <attributeName>.

SdaiSelect

pSel

Address of the tSdaiSelect type structure that contains the typed specification of the actual aggregate. The actual aggregate is typed with a path of pSel->nTypes elements. The actual path is found in the buffer pointed to by pSel->typeList. Each element in this buffer is a numeric typeID identifying a defined type instance in the EDMdatabase, hence the type specification consist of one ore more typeID that uniquely defines the typed aggregate. The last typeId in the pSel->typeList defines the aggregate type and the element type of the actual created aggregate. The typeID is retrieve by the edmiGetDefinedType or the edmiGetDefinedTypeBN operations.

Return Value


TypeComment
SdaiAggr 

Options


  

 

Example


 

SCHEMA Example;
 . . . 
 TYPE anAggr = SELECT (anArray, aList); END_TYPE; 
 TYPE anArray = ARRAY[1:100] of Person; END_TYPE; 
 TYPE aList = LIST of Child; END_TYPE; 
 . . . 
 ENTITY anEntity; 
 attr : anAggr; 
 . . . 
 END_ENTITY; 
 . . . 
 END_SCHEMA;
 */
 SdaiModel modelId;
 SdaiAggr aggrId;
 SdaiAppInstance anInst;
 SdaiAttr attrId;
 tSdaiSelect mySelect;
 ...
 anInst = sdaiCreateInstanceBN(modelId, "anEntity");
 mySelect.typeList = (SdaiInstance *) malloc(1 * sizeof(SdaiInstance));
 mySelect.typeList[0]= edmiGetDefinedTypeBN("Example", "anArray");
 mySelect.nTypes = 1;
 aggrId = edmiCreateTypedAggrBN (anInst, "Attr", &mySelect);
 if (! aggrId) {
 /* Error in operation */ 
 printf("\nError in edmiCreateTypedAggrBN: %s\n", 
 edmiGetErrorText(sdaiErrorQuery())); 
 goto error; 
 }
 . . .

 

See also

Filter by label

There are no items with the selected labels at this time.

Â