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


TypeNameComment
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

  • In: The index of the aggregate element to start searching at. The index of the first element in the actual aggregate will always be index zero, independent of the aggregate type. Hence the legal index range is: 0<= index < number of elements in the aggregate.
  • Out: The index of the "last returned matching element". This argument enables the caller to search for instances in an incremental way by specifying this returned "index value plus one" as the input to the next edmiSelectAggrInstances function and so on.
SdaiInteger

hits

  • In: Specifies the maximum number of matching instances to return. If this number is greater than the limitation specified by the <maxBufferSize> argument, then the maximum number of hits will be calculated from the <maxBufferSize> argument.
  • Out: The number of matching instances found.
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


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

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.