edmiFindAggrInstancesBN

EdmiError edmiFindAggrInstancesBN(SdaiInstance instance,
                                   SdaiString   attributeName, 
                                   SdaiString   condition, 
                                   SdaiInteger  maxBufferSize, 
                                   SdaiInteger  *index, 
                                   SdaiInteger  *numberOfHits, 
                                   SdaiInstance *resultBuffer); 

Search in the specified aggregate for instances that matches the specified condition. The condition is specified as attribute values of the instances in the aggregate. All instances in the specified aggregate will match an empty condition, i.e. the <condition> argument set to NULL. Each matching instance is identified by a numeric instanceID that uniquely identifies an instance in the EDMdatabase. The index of the first aggregate element to test for matching the specified condition, and the maximum number of matching instances to return, are specified as input arguments to the function. The actual number of matching instances returned and the "index of the last returned matching instance in the aggregate" are returned from the operation. This makes it convenient to query an aggregate by the edmiFindAggrInstancesBN function in an incremental way. The actual model hosting the specified aggregate to query must be open before this operation can be successfully performed. When the input arguments <maxBufferSize> == 0 & <resultBuffer> == NULL no instanceId or elementNumber will be returned. Only the number of matching instances/elements will be returned.

Arguments


TypeNameComment
SdaiInstance

instance

A numeric instanceID that uniquely identifies the instance in the EDMdatabase that owns the aggregate to be queried. This instanceID is returned when the actual instance is created by the sdaiCreateInstance or sdaiCreateInstanceBN operations.

SdaiString

attributeName

Name of the attribute that owns the aggregate to be queried. Attribute names are case insensitive. The <attributeName> must be qualified with the ENTITY name when the attribute name is not unique within the Entity.

SdaiString

condition

Specifies the condition the target instances should match. All instances in the specified aggregate match an empty condition, i.e. <condition> = NULL.

SdaiInteger

maxBufferSize

Specifies the size (in number of bytes) of the buffer to receive the instanceID of the matching instances. The actual number of returned matching instances will never be greater than the number of instanceID that can be placed in a buffer of the size specified by 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 edmiFindAggrInstancesBN function and so on.
SdaiInteger

numberOfHits

  • 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 found matching instances.
SdaiInstance

resultBuffer

Address of a buffer in the calling application that will receive the instanceID of each returned matching instance. This buffer is mapped to a SdaiInstance array when the instanceID of each returned matching instance is stored. The <maxBufferSize> argument should prevent the function to write past buffer.

Return Value


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

Options


 

Example


 

SdaiInstance deparmentId;
 int i;
 SdaiInteger index,hits;
 SdaiInstance resultBuffer[MAX_ELEMENTS];
 ...
 index = 0; /* start on first aggregate element */
 hits = MAX_ELEMENTS; /* max number of hits */
 if (rstat = edmiFindAggrInstancesBN(departmentId,
 "Employees", 
 "(Sex = FEMALE) and (Age >= 25)", 
 sizeof(resultBuffer), 
 &index, 
 &hits, 
 resultBuffer)) { 
 /* Error in operation */ 
 printf("\nError: %s in edmiFindAggrInstancesBN\n", 
 edmiGetErrorText(rstat)); 
 goto error; 
 }
 /* print out the instanceID of the matching instances */
 for (i = 0; i < hits; i++) {
 printf("\nInstance: #%12ld", resultBuffer[i]);
 }
 ...

 

See also

Filter by label

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

Â