edmiRemoteIsMember
EdmiError edmiRemoteIsMember(SdaiServerContext serverContextId, SdaiAggr aggrId, SdaiVersion version, SdaiOptions options, SdaiInteger index, SdaiBoolean *isMember, SdaiInteger *matchingElements, SdaiInteger **indexOfMatchingElements, SdaiInvocationId *edmiInvocationId, SdaiPrimitiveType valueType, ...);
Determines whether a specified primitive type value exists within one or more of the elements of a specified aggregate in a remote EDMdatabase. This operation returns sdaiTRUE if at least one element with the specified value exists in the given aggregate. Else sdaiFALSE is returned. Optionally, a buffer containing the index of all matching aggregate elements may be returned. The returned buffer locates the matching elements. Note that these element indexes are affected for List, Set and Bag type aggregates when elements are added or deleted.
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 |
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. |
SdaiOptions | options | See description of available options below. Options may be joined by using the bitwise OR operator |
SdaiInteger | index | The index of the aggregate element to start reading at. This argument is only applicable for Array and List aggregates. Set and Bag aggregates are always indexed from zero. |
SdaiBoolean | isMember | A variable that will receive sdaiTRUE if the specified element value was found at least once among the aggregate elements. |
SdaiInteger | matchingElements | A variable that will receive the number of matching elements in the aggregate. |
SdaiInteger | indexOfMatchingElements | A variable that will receive a pointer to a buffer of element indexes. The returned indexes locate the aggregate elements in which the specified value was found. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
SdaiPrimitiveType | valueType | The primitive type of the value given in the variable argument list of this function. This data type must be the same as that of the elements in the aggregate specified by the <aggrId> argument. |
Return Value
Â
Options
 Â
Name | Comment |
GET_INDEX_OF_MATCHING_ELEMENTS | A buffer containing the index of all the aggregate elements in which a matching value was found will be generated and returned in the <indexOfMatchingElements> argument. |
GET_NUMBER_OF_MATCHING_ELEMENTS | Only the number of matching aggregate elements will be returned in the <matchingElements> argument. |
Â
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; */ #define S_TECHNICAL_DIVISION 2 EdmiError rstat; SdaiInteger nHits, index; SdaiServerContext myContext; SdaiInstance manningId, johnnyId; SdaiAggr parentAggrId, childAggrId; SdaiQueryResult qexRes; SdaiBoolean isEmployee; SdaiInteger *indexBuff; /* 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 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 child aggregate with staff info for the technical division*/ rstat = edmiRemoteGetAggrElement(myContext, parentAggrId, 0, S_TECHNICAL_DIVISION, sdaiAGGR, &childAggrId, NULL); /* Get the johnnyId instance. */ index = 0; nHits = 1; rstat = edmiRemoteSelectInstances(myContext, "AdminRepository", "Employees", "Person", "(NAME = 'Johnny') AND (AGE = 32)", ONLY_INSTANCE_IDS, NULL, NULL, NULL, &index, &nHits, &qexRes, NULL, NULL, NULL, NULL); johnnyId = qexRes->instanceIds[0]; edmiFreeQueryResult(qexRes); /* Check if Johnny is one of the employees in technical division */ rstat = edmiRemoteIsMember(myContext, childAggrId, 0, GET_INDEX_OF_MATCHING_ELEMENTS, 0, &isEmployee, &nHits, &indexBuff, NULL, sdaiINSTANCE, johnnyId); edmiFree(indexBuff); printf("\nJohnny is %s an employee.", isEmployee ? "":"not"); . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â
Options: Descriptions:
Â