edmiRemoteGetAggrElement

EdmiError edmiRemoteGetAggrElement(SdaiServerContext serverContextId,
                                     SdaiAggr          aggrId,
                                     SdaiVersion       version,
                                     SdaiAggrIndex     index,
                                     SdaiPrimitiveType valueType,
                                     SdaiVoid          pValue,
                                     SdaiInvocationId  *edmiInvocationId);

Returns the contained value in an aggregate element, specified by the element index. The element primitive type, specified by the <valueType> argument, must be the same as that of the aggregate element declaration or any compatible type. sdaiSELECT may be used to retrieve all data types. sdaiADB may be used to retrieve all data types except typed values. sdaiINTEGER is compatible with sdaiREAL. sdaiBOOLEAN is compatible with sdaiLOGICAL. Conversion between compatible data types will be performed automatically when required. This operation is applicable to all aggregate types. Aggregate elements are specified by their element index. The legal index range for List, Set and Bag is [0 <= index < N], where N is the number of elements in the aggregate. For Array aggregates, the legal index range is;

[DeclaredLowerBound <= index <= DeclaredUpperBound]


The declaration of the upper bound and lower bound is found in the underlying Express Schema of the edmModel in which the aggregate is contained. These bounds may also be found by the function edmiRemoteGetAggrDescr .

Arguments


TypeNameComment
SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

SdaiAggr         

aggrId

A numeric aggregateID that uniquely identifies the aggregate of interest in the remote  EDMdatabase

SdaiVersion      

version

The version of the edmModel to apply this function call on. The <version> parameter is a numeric sequence number counting from one by increments of one for each new model version that is created. A zero model version number means the current version.

SdaiAggrIndex

index

The index of the aggregate element to retrieve.

SdaiPrimitiveType

valueType

The primitive type of the aggregate element to retrieve.

SdaiVoid

pValue

A variable that will receive the value read from the specified aggregate element. The type of <pValue> must be the same or a compatible type of <valueType>.

SdaiInvocationId

edmiInvocationId

Currently not used.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


 

Example


 

 /*
 SCHEMA Employees
 ENTITY person; 
 Name : STRING; 
 Age : INTEGER; 
 END_ENTITY; 
  
 ENTITY Manning; 
 DivisionStaff : ARRAY [0:4] OF SET OF person; 
 END_ENTITY; 
 END_SCHEMA;
 */
 int i;
 EdmiError rstat;
 SdaiInteger nHits, nEmployees, index;
 SdaiServerContext myContext;
 SdaiInstance manningId;
 SdaiAggr parentAggrId, childAggrId;
 SdaiQueryResult qexRes;
 SdaiAggrType aggrType;
 SdaiInteger lowerBound, upperBound, members;
 SdaiInstance elementId, domainId;
 SdaiBoolean isOptional, isUnique;
 SdaiPrimitiveType dataType;
  
 /* Create Server Context */
 rstat = edmiDefineServerContext("MyContext",
 "Johnny", "Supervisor", "cf37ftr", 
 "TCP", "9090", "MyServerHost", 
 NULL, NULL, NULL, NULL, NULL, &myContext); 
  
 /* Get the manningId instance. It is assumed that
 there is only one instance of type Manning */ 
 index = 0;
 nHits = 1;
 rstat = edmiRemoteSelectInstances(myContext, "AdminRepository",
 "Employees", "Manning", NULL, ONLY_INSTANCE_IDS, 
 NULL, NULL, NULL, &index, &nHits, &qexRes,  
 NULL, NULL, NULL, NULL); 
 manningId = qexRes->instanceIds[0];
 edmiFreeQueryResult(qexRes);
  
 /* Get the parent aggregate Id */
 rstat = edmiRemoteGetAttrsBN(myContext, manningId, 0, 1, NULL,
 "DivisionStaff", sdaiAGGR, &parentAggrId); 
  
 /* Get the parent aggregate descriptor */
 rstat = edmiRemoteGetAggrDescr(myContext, parentAggrId,
 &aggrType, &lowerBound, &upperBound,  
 &elementId, &domainId, &isOptional,  
 &isUnique, &dataType, &members, NULL); 
  
 /* Count the employees in all divisions */
 for (i=lowerBound; i<=upperBound; i++) {
 rstat = edmiRemoteGetAggrElement(myContext, parentAggrId,  
 0, i, sdaiAGGR, &childAggrId, NULL); 
 rstat = edmiRemoteGetMemberCount(myContext, 
 childAggrId, 0, &nEmployees, NULL); 
 printf("\nDivision %d: %d employees.", i, nEmployees); 
 }
 . . .

 

See also

Filter by label

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

Â