xpfCreateNestedTypedAggr

FUNCTION xpfCreateNestedTypedAggr (aggregateId    : AGGREGATE OF GENERIC;
                                   typePath       : LIST OF GENERIC)  
                                   newAggregateId : AGGREGATE OF GENERIC;
                

The xpfCreateNestedTypedAggr function 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. The argument <aggregateId> specifies the parent aggregate of the one to be created, and the ID of the created aggregate is returned in the argument <newAggregateId>. All EDMexpressX access operation defined for untyped aggregates is applicable on typed aggregates. 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. A struct of type SdaiSelect containing the aggregate typing should be supplied. This operation is legal for parent aggregate of type LIST, SET, and BAG aggregates. When this operation is applied on a LIST aggregate, the new created typed 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 EDMexpressX 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 EDMexpressX put operations, it can only be returned as data value in EDMexpressX 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
AGGREGATE OF GENERICaggregateIdcomments
LIST OF GENERICtypePath 

Return Value


 

TypeNameComment
AGGREGATE OF GENERICnewAggregateIdcomments

Options


 

Example


SCHEMA mySchema;
TYPE tArray = ARRAY[1:1] of INTEGER; END_TYPE;
TYPE tList = LIST of STRING; END_TYPE;
TYPE tAggr = SELECT (tArray, tList); END_TYPE;
 
ENTITY myEntity;
aAggr : LIST OF tAggr;
END_ENTITY;
END_SCHEMA;
 
SCHEMA_MAP myMap;
GLOBAL
DECLARE src INSTANCE OF SOURCE_SCHEMA mySchema;
DECLARE trg INSTANCE OF TARGET_SCHEMA mySchema;
END_GLOBAL;
 
STATEMENTS;
LOCAL
MyType : GENERIC;
MyInst : trg::MyEntity;
  aAggr : GENERIC;
END_LOCAL;
 
NEW PERSISTENT MyInst;
MyType := xpfGetDefinedType(XPXTARGETMODELID, 'tArray');
 MyInst.aAggr := [];
aAggr := xpfCreateNestedTypedAggr(MyInst.aAggr, [MyType]);
END_STATEMENTS;
END_SCHEMA_MAP;

 

See also

Filter by label

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

  
Â