...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiRemoteGetMemberCount(SdaiServerContext serverContextId,
SdaiAggr aggrId,
SdaiVersion version,
SdaiInteger *members,
SdaiInvocationId *edmiInvocationId);
|
Returns the number of elements in an aggregate in a remote EDMdatabase
Arguments
...
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiAggr | aggrId | A numeric aggregateID that uniquely identifies the aggregate of interest in the remote _EDMdatabase._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. |
SdaiInteger | members | A variable that will receive the number of elements in the aggregate. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
...
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Example
...
Code Block | ||
---|---|---|
| ||
/*
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 (Content by label) | ||||||
---|---|---|---|---|---|---|
|