edmiCreateNestedTypedAggrByIterator

SdaiAggr edmiCreateNestedTypedAggrByIterator(SdaiIterator iterId,
                                              SdaiSelect   pSel); 

Creates a typed 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 typed aggregate will be a child aggregate of the already existing aggregate. Nested typed aggregates must be used when the data type specification of the elements of the parent aggregate is not uniquely defined in the appropriate Express schema. This can only occur when the actual element specification is of type SELECT. All EDMinterface access operation defined for untyped aggregates is applicable on typed aggregates. A struct of type SdaiSelect containing the aggregate typing should be supplied. This operation is legal for all parent aggregates of any aggregate types with the following effect:

  1. For ARRAY : The new created typed aggregate will be inserted at the element pointed to by the specified <iterator>. If an element already exists in this position, the existing element will be replaced by the new one.
  2. For LIST: The new created typed aggregate will be appended to the parent list aggregate
  3. For BAG and SET: The new typed aggregate will be added to the parent bag or set aggregate.

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 .

Arguments


TypeNameComment
SdaiIterator

iterId

A numeric iteratorID that uniquely identifies an iterator in the actual EDMserver session. The aggregate connected to this actual iterator will be the parent aggregate of the new created typed aggregate. The iterator's current element position will influence the position of the new aggregate in the parent aggregate. See above for more details.
The iteratorID is defined by the sdaiCreateIterator function.

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


 

 /* EXPRESS
 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; 
 attr1 : SET of anAggr; 
 attr2 : ARRAY[1:10] of anAggr; 
 . . . 
 END_ENTITY; 
 . . . 
 END_SCHEMA;
 */
 SdaiModel modelId;
 SdaiAggr myAggr, parentAggr;
 SdaiAppInstance anInst;
 tSdaiSelect mySelect;
 SdaiIterator iterId;
 ...
 anInst = sdaiCreateInstanceBN(modelId, "anEntity");
 parentAggr = sdaiCreateAggrBN(anInst, "attr1");
 iterId = sdaiCreateIterator(parentAggr);
 . . .
 mySelect.typeList = (SdaiInstance *) malloc(1 * sizeof(SdaiInstance));
 mySelect.typeList[0]= edmiGetDefinedTypeBN("Example", "aList");
 mySelect.nTypes = 1;
 myAggr = edmiCreateNestedTypedAggrByIterator (iterId , &mySelect);
 if (! myAggr) {
 /* Error in operation */ 
 printf("\nError in edmiCreateNestedTypedAggrByIterator: %s\n", 
 edmiGetErrorText(sdaiErrorQuery())); 
 goto error; 
 }
 ... 

 

See also

Filter by label

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

Â