edmiSelectAggrInstances
EdmiError edmiSelectAggrInstances(SdaiAggr aggrId, SdaiString condition, SdaiInteger options, SdaiInteger maxBufferSize, SdaiInteger *index, SdaiInteger *hits, SdaiInstance *buffer);
Selects a subset of an aggregate of instances based on any given Express-X conditional statement. The matching elements will be returned in a buffer.
Arguments
Type | Name | Comment |
SdaiAggr | aggrId | A numeric aggregateID that uniquely identifies the aggregate of interest in the EDMdatabase. This may be any type of aggregate, both persistent and scratch with elements of instance types. The aggregateID is returned when the aggregate is created or it can be retrieved with an EDMinterface get operation. |
SdaiString | condition | A conditional statement, written in Express-X, that the aggregate instances shall match. An empty condition, i.e., <condition> = NULL will match all aggregate elements. All legal symbolic Express-X logical expressions are legal <condition> values. This <condition> argument will be compiled by the EDMexpressXCompiler |
SdaiInteger | options | Not used. |
SdaiInteger | maxBufferSize | Specifies the size (in number of bytes) of the buffer used for receiving the instanceIDs of the matching instances. The number of returned matching instances may never exceed the number that fits into a buffer with the size specified in this argument. |
SdaiInteger | index |
|
SdaiInteger | hits |
|
SdaiInstance | buffer | The buffer, allocated by the calling application, that will receive the instanceIds of all the returned matching instances. Use the <maxBufferSize> or <hits> argument to prevent writing outside this buffer. |
Return Value
Options
Example
#define NOBUFF 1024 int i; EdmiError rstat; SdaiAggr myAggrId; SdaiInstance buff[NOBUFF]; SdaiInteger buffsize = (NOBUFF * sizeof(SdaiInstance)); SdaiInteger index = 0; SdaiInteger nHits = NOBUFF; SdaiString phoneNo, prof; SdaiInteger age; . . . if (rstat = edmiSelectAggrInstances(myAggrId, "(SELF.LAST_NAME = 'SCHMIDT') AND (SELF.AGE > 40)", 0, buffsize, &index, &nHits, &buff[0])) { printf("\nError %d in edmiSelectAggrInstances: %s", rstat, edmiGetErrorText(rstat)); goto err; } if (! nHits) { printf("\nNo persons with the name 'SCHMIDT' found"); }else { printf("\n%d persons found with the name 'SCHMIDT'"); for (i=0;i<nHits;i++) { sdaiGetAttrsBN (buff[i], 3, "AGE", sdaiINTEGER, &age, "PHONENO", sdaiSTRING, &phoneNo, "PROFESSION", sdaiSTRING, &prof); printf("\n%d: SCHMIDT (%d), %s <%s>", i, age, phoneNo, prof); } } . . .
See also
Filter by label
There are no items with the selected labels at this time.