edmiRemoteFindAggrInstancesBN

EdmiError edmiRemoteFindAggrInstancesBN(SdaiServerContext serverContextId, 
                                          SdaiInstance      instance, 
                                          SdaiString        attributeName, 
                                          SdaiString        condition, 
                                          SdaiInteger       maxBufferSize, 
                                          SdaiInteger       *index, 
                                          SdaiInteger       *numberOfHits, 
                                          SdaiInstance      *resultBuffer, 
                                          SdaiInvocationId  *edmiInvocationId); 

Search a specified aggregate of instances in a remote edmModel for instances that match a specified condition. The condition must be a simple logical expression addressing only the simple type attribute values of the instance elements. A NULL or empty string condition will match all the aggregate elements. Each matching element will be identified by its aggregate element index. Note that even though the ISO10303 standard specifies no such thing as an internal ordering of the elements within the unordered bag and set type aggregate, the elements may still be indexed as long as the aggregates remain  unchanged. The index of the first aggregate element to check, and the maximum number of matching element indexes to return, are specified as input arguments to the function. The actual number of matching elements returned and the index of the last returned matching element in the aggregate will be returned from the function. This makes it possible to query through huge aggregates by means of a loop where each iteration handles small subset of the total aggregate. See the example below. When the <maxBufferSize> argument is zero and the <resultBuffer> argument is NULL. Nothing but the number of matching aggregate elements will be returned.

Arguments


TypeNameComment
 SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

 SdaiInstance

instance

The numeric instanceID that uniquely identifies the instance in the remote EDMdatabase that owns the aggregate to be queried.

 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 name of the entity from which it was originally inherited if it is not unique within the Entity.

 SdaiString

condition

The condition that the instances in the aggregate shall match. A NULL or empty string condition will match all the elements. The condition statement must be on the form "attribute = value"
Example condition:
"NAME = 'Johnny'" or "AGE > 30".
For more complex logical expressions, use edmiRemoteSelectAggrInstances

 SdaiInteger

maxBufferSize

The size of the buffer in which the indexes of all the matching aggregate elements will be returned. The number of returned indexes will never exceed this number.

 SdaiInteger

index

  • In: The index of the aggregate element to start reading from. The first element is indexed zero. Hence the legal index range is: [ 0 <= index < N ] , where N is the number of elements in the aggregate.
  • Out: The index of the last returned matching element. If the return value is incremented by one, it may be used as input value for succeeding calls to the same function. This way, the second call will start reading aggregate elements where the first call finished. this will reduce the required size of the <resultBuffer>.
 SdaiInteger

numberOfHits

  • In: The maximum number of matching aggregate element indexes to return. If this number is greater than the limitation specified by the <maxBufferSize> argument, the maximum number of hits will be overruled by the value given in the <maxBufferSize> argument.
  • Out: The number of matching aggregate element indexes returned.
 SdaiInstance

resultBuffer

A buffer, allocated by the calling application, that will receive the indexes of the matching aggregate elements. Use the <maxBufferSize> argument to prevent writing past the end of this buffer.

 SdaiInvocationId

edmiInvocationId

Currently not used.

Return Value


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

 

Options


  

 

Example


 

 /*
 SCHEMA Furniture 
 TYPE tScrewType = ENUMERATION OF (PHILIPS, ALLEN, FLAT); END_TYPE; 
 ENTITY screw; 
 ID : STRING; 
 TYPE : tScrewType; 
 LEN : REAL; 
 DIA : REAL; 
 END_ENTITY; 
 ENTITY dining_table; 
 Name : STRING; 
 Legs : INTEGER; 
 Length : REAL; 
 Width : REAL; 
 Height : REAL; 
 Screws : BAG OF screw; 
 END_ENTITY; 
 END_SCHEMA; 
 */
 #define S_BATCHSIZE 10
 EdmiError rstat;
 SdaiInteger nHits, index;
 SdaiServerContext myContext;
 SdaiInstance tableId;
 SdaiQueryResult qexRes;
  
 /* Create Server Context */
 rstat = edmiDefineServerContext("MyContext",
 "Johnny", "Supervisor", "cf37ftr", 
 "TCP", "9090", "MyServerHost", 
 NULL, NULL, NULL, NULL, NULL, &myContext); 
  
 /* Get the id of the dining table
 with the unique name 'PIZA-210' 
 in the FURNITURE_DESIGN model. */ 
 index = 0;
 nHits = 1;
 rstat = edmiRemoteSelectInstances(myContext, "DataRepository",
 "FURNITURE_DESIGN", "DINING_TABLE", "NAME = 'PIZA-210'",  
 ONLY_INSTANCE_IDS, NULL, NULL, NULL,  
 &index, &nHits, &qexRes,  
 NULL, NULL, NULL, NULL); 
 tableId = qexRes->instanceIds[0];
 edmiFreeQueryResult(qexRes);
  
 /* Find the number of screws of type
 Allen 5mm x 75mm used for the 
 dining table 'PIZA-210' */ 
 index = 0;
 nHits = 1000;
 rstat = edmiRemoteFindAggrInstancesBN(myContext,
 tableId, "SCREWS", 
 "(LEN=75) AND (DIA=5) AND (TYPE=ALLEN)",  
 0, &index, &nHits, NULL, NULL); 
  
 printf("\n%d screws of type Allen 5mm x 75mm used", &nHits);
 . . . 

 

See also

Filter by label

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

Â