Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Code Block
languagecpp
themeConfluence
SdaiAggr edmiCreateTypedAggr(SdaiAppInstance  currInst,
                              SdaiAttr         attrId, 
                              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 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.

...



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.

SdaiAttr

attrId

A numeric attributeID that uniquely identifies an attribute definition instance in the EDMdatabase. This attribute definition instance defines the domain of the actual typed aggregate. The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions.

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

...

 

Code Block
languagecpp
 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 = edmiCreateTypedAggr(anInst, attrId, &mySelect);

...


 if (! aggrId) {

...


 /* Error in operation */

...

 
 printf("\nError in edmiCreateTypedAggr: %s\n",

...

 
 edmiGetErrorText(sdaiErrorQuery()));

...

 
 goto error;

...

 
 }
 . . .

 

See also

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "model" and parent = "6062220"