edmiGetInstanceReferences

EdmiError edmiGetInstanceReferences(SdaiInstance currInst,
                                     SdaiInteger  index, 
                                     SdaiInteger  *numberOfRefs, 
                                     SdaiInstance *resultBuffer); 

Returns the instances that have one or more relations to the specified instance. The number of relations each instance has with the specified instance cannot be found by this function. Only relations between instances in an Explicit attribute role are returned. It can be viewed that all instances that have at least one relation to one particular instance are held in an aggregate. The edmiGetInstanceReferences function operates on this aggregate. The index of the aggregate element to start on and the number of instances to return in one invocation of this function can be specified as arguments. This method makes it convenient to read the referencing instances in an incremental way, i.e. by several invocation of the edmiGetInstanceReferences function. Each referencing instance is identified by a numeric instanceID that uniquely identifies an instance in an EDMdatabase. This operation is only applicable on application instances. The actual data model that holds the specified instance must be open before this function can be successfully performed.

It is possible to disable the storing instance references option for each individual data model at model creation time. When the storing instance references option is disabled, then the edmiGetInstanceReferences operation will return an error code

Arguments


TypeNameComment
SdaiInstance

currInst

A numeric instanceID that uniquely identifies the instance of interest in the EDMdatabase.  The instanceID is defined by a sdaiCreateInstance or a sdaiCreateInstanceBN operation.

SdaiInteger

index

The reference index to start on.  The legal index range is: 0<= index < number of referencing instances.

SdaiInteger

numberOfRefs

  • In-value: The maximum referencing instances to return. This value should be less or equal to the number of instanceID that can be placed in the buffer specified by the <resultBuffer> argument to prevent writing past this buffer.
  • Out-value: The actual number of referencing instances returned. This value is always less or equal to the in-value.
SdaiInstance

resultBuffer

The address of a buffer in the calling application that will receive an instanceID for all returned instances that have one or more relations to the specified instance. The argument <numberOfRefs> should be set according to the size of this buffer to prevent this function from writing past buffer.

Return Value


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

Options


 

Example


 

 int i;
 EdmiError rstat;
 SdaiInstance currInst,resultBuffer[MAX_REFS];
 SdaiInteger index,nrefs;
 . . .
 index = 0;
 for(; {
 nrefs = MAX_REFS; 
 if (rstat = edmiGetInstanceReferences(currInst, 
 index,  
 &nrefs, 
 resultBuffer)) { 
 /* Error in operation */ 
 printf("\nError: %s in edmiGetInstanceReferences\n", 
 edmiGetErrorText(rstat)); 
 goto error; 
 } 
 if (! nrefs) break; /* No more references */ 
 /* print referencing instances */ 
 for (i = 0; i < nrefs; i++) {
 printf("\n#%lu",resultBuffer[i]); 
 }
 index += nrefs; 
 }
 . . .

 

See also

Filter by label

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