edmiRemoteCreateTypedAggr
Â
EdmiError edmiRemoteCreateTypedAggr(SdaiServerContext serverContextId, SdaiAppInstance currInst, SdaiAttr attrId, SdaiSelect pSel, SdaiAggr *aggrId, SdaiInvocationId *edmiInvocationId);
Creates an empty typed aggregate instance on an explicit attribute of an instance within an edmModel in the remote EDMdatabase. The aggregate attribute is identified by its attributeId. Typed aggregates are required when the attribute domain definition in the edmModels underlying Express Schema does not uniquely define the type of the elements to be held by the aggregate. This may only happen when the declared aggregate elements are of type SELECT. When creating a typed aggregate, a struct of type tSdaiSelect with a type specification of the aggregate elements must be supplied. A numeric aggregateID will be returned from the function. This id uniquely identifies the typed aggregate within the remote EDMdatabase. The aggregateID will remain unchanged throughout the lifetime of the aggregate and may be used to identify the aggregate in subsequent calls to EDMinterface API functions. The type of aggregate to be created is determined by the attribute declaration within the underlying Express Schema of the edmModel. The attribute that will own the aggregate is specified by the <attributeName> argument. If the attribute name is not unique within the actual instance, it must be qualified with the name of the entity from which the attribute was originally inherited.
An aggregateID may not be handled as a plain data value. Aggregates must be created on the explicit attributes of entities that have been predeclared to hold them in the underlying Express Schema of the edmModel. An aggregateId may be retrieved by an EDMinterface Get operation, but it may not be used to populate other attributes by means of EDMinterface Put operations.
Arguments
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
 SdaiAppInstance | currInst | A numeric instanceID that uniquely identifies an instance in the remote EDMdatabase that owns the attribute on which to create the typed aggregate. |
 SdaiAttr | attrId | A numeric attributeId that uniquely identifies the attribute in the remote EDMdatabase |
 SdaiSelect | pSel | Pointer to a locally allocated tSdaiSelect data structure that contains the type specification of the typed aggregate elements. The aggregate is typed with a path of pSel->nTypes elements. The path must be specified in the buffer pointed to by pSel->typeList. Each element in this buffer is a numeric typeID identifying a defined type instance in the remote EDMdatabase . The last specified typeID in the pSel->typeList buffer defines the element type of the typed aggregate. |
 SdaiAggr | aggrId | Variable that will receive the aggregateId that uniquely identifies the typed aggregate in the remote EDMdatabase |
 SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Â
Options
 Â
Â
Example
Â
 /* SCHEMA Accounts TYPE tUSD = REAL; END_TYPE; TYPE tEUR = REAL; END_TYPE; TYPE tNOK = REAL; END_TYPE; TYPE tAmount = SELECT (tUSD, tEUR, tNOK); END_TYPE; ENTITY Turnover; Year Sales : ARRAY [1:12] OF tAmount; END_ENTITY; END_SCHEMA; */ EdmiError rstat; SdaiServerContext myContext; SdaiAggr aggrId; SdaiType tAmountId; SdaiInstance instId; SdaiAttr attrId; tSdaiSelect sel; SdaiSelect salesAmount = &sel; /* Create Server Context */ rstat = edmiDefineServerContext("MyContext", "Johnny", "Supervisor", "cf37ftr", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &myContext); /* Create instance of sales */ rstat = edmiRemoteCreateInstanceAndPutAttrsBN(myContext, "AdminRepository", "Economy", "Turnover", 0, &instId, NULL); /* Get the attribute Id */ rstat = edmiRemoteGetAttrDefinitionBN(myContext, "Accounts", "Turnover", "Sales", &attrId, NULL); /* Get the type Id of tAmount */ rstat = edmiRemoteGetDefinedTypeBN(myContext, "Accounts", "tAmount", &tAmountId, NULL); /* Create typed aggregate */ salesAmount->nTypes = 1; salesAmount->type = sdaiREAL; salesAmount->typeList = &tAmountId; salesAmount->value.realVal = 0; rstat = edmiRemoteCreateTypedAggr(myContext, instId, attrId, salesAmount, &aggrId, NULL); . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â