edmiRemoteCreateNestedAggr


 

EdmiError edmiRemoteCreateNestedAggr(SdaiServerContext serverContextId,
                                       SdaiAggr          parentAggrId, 
                                       SdaiAggrFunction  aggrFunction, 
                                       SdaiAggrIndex     aggrIndex,
                                       SdaiAggr          *newAggrId, 
                                       SdaiInvocationId  *edmiInvocationId); 

Creates an empty nested aggregate within an already existing aggregate. The existing aggregate is denoted the parent aggregate. The nested aggregate to be created is denoted the child aggregate of its parent aggregate. The type of child aggregate that results from this operation is determined by the aggregate element declaration of the parent aggregate in the underlying Express Schema of the edmModel. Suppose the declaration of the attribute myAttr is;
myAttr : LIST [1:3] OF ARRAY [1:12] OF STRING;
This function would create an array of 12 elements within one of the three elements of the list. The list would have to be created and identified by its aggregateId before invoking this function. A numeric aggregateID will be returned from the function. This id uniquely identifies the aggregate within the remote EDMdatabase. The aggregateID will remain unchanged throughout the lifetime of the aggregate and may be used to identify the aggregate in subsequent calls to EDMinterface API functions. The parent aggregate that will be the owner of the nested child aggregate is specified by its aggregateId in the <parentAggrId> argument. AggregateIDs may not be considered plain data values. Nested child aggregates must be created within their parent aggregates. Child aggregateIds may be retrieved by EDMinterface Get operations, but they may not be used to populate parent aggregates by means of EDMinterface Put operations.
This operation is only applicable to aggregates owned by explicit attributes of application instances.

Arguments


1TypeNameComment
2 SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

3 SdaiAggr

parentAggrId

A numeric aggregateID that uniquely identifies the aggregate of interest in the remote  EDMdatabase

4 SdaiAggrFunction

aggrFunction

Determines the insert point of the created nested aggregate in its parent aggregate. The following is a description of each of the legal values of this argument.

  • ADD_ELEMENTS: Applicable for the unordered aggregates Set and Bag. May also be used for List, but will then be interpreted as APPEND_ELEMENTS
  • APPEND_ELEMENTS: The nested aggregate will be appended to the end of the existing list. Applicable for List aggregates only.
  • PREPEND_ELEMENTS: The nested aggregate will be pretended to the start of the existing list. Applicable for List aggregates only.
  • INSERT_BEFORE_INDEX: The nested aggregate will be created in the array element with an index that is one less than the index given by the <index> argument. Applicable only for the ordered aggregates aggregates List and Array.
  • INSERT_AFTER_INDEX: The nested aggregate will be created in the array element with the index given by the <index> argument. Applicable only for the ordered aggregates aggregates List and Array.
  • ACCESS_BY_INDEX: The nested aggregate will be created in the array element with an index that is one greater than the index given by the <index> argument. Applicable only for the ordered aggregates aggregates List and Array.
5 SdaiAggrIndex

aggrIndex

A parent aggregate element position that is used to determine the insertion point of the created nested aggregate.  Applicable only for the ordered aggregates List and Array

6 SdaiAggr

newAggrId

Variable that will receive the aggregateId that uniquely identifies the nested typed aggregate in the remote EDMdatabase.

7 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


  

OptionComment
Option nameComment

 

Example


 

 Example:
 /*
 SCHEMA Employees
 ENTITY person; 
 Name : STRING; 
 Age : INTEGER; 
 END_ENTITY; 
  
 ENTITY Manning; 
 DivisionStaff : ARRAY [0:4] OF SET OF person; 
 END_ENTITY; 
 END_SCHEMA;
 */
  
 #define S_NOOF_DIVISIONS 5
 int i;
 EdmiError rstat;
 SdaiServerContext myContext;
 SdaiInstance manningId;
 SdaiAggr parentAggrId;
 SdaiAggr childAggrId[S_NOOF_DIVISIONS];
  
 /* Create Server Context */
 rstat = edmiDefineServerContext("MyContext",
 "Johnny", "Supervisor", "cf37ftr", 
 "TCP", "9090", "MyServerHost", 
 NULL, NULL, NULL, NULL, NULL, &myContext); 
  
 /* Create instance of Employees */
 rstat = edmiRemoteCreateInstanceAndPutAttrsBN(myContext,
 "AdminRepository", "Employees", 
 "Manning", 0, &manningId, NULL); 
  
 /* Create the parent aggregate */
 rstat = edmiRemoteCreateAggrAndWriteAggrElementsBN(myContext,
 manningId, "DivisionStaff", 0, 0, 0, NULL, 
 &parentAggrId, NULL); 
  
  
 /* Create child aggregates for
 all company divisions */ 
 for (i=0;i<S_NOOF_DIVISIONS;i++) {
 rstat = edmiRemoteCreateNestedAggr(myContext, parentAggrId,  
 ACCESS_BY_INDEX, i, &childAggrId[i], NULL); 
 }
 . . .

 

See also

Filter by label

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

Â