edmiRemotePutAttrsEx

EdmiError edmiRemotePutAttrsEx(SdaiServerContext serverContextId,
                                 SdaiAppInstance   instance, 
                                 SdaiInteger       attributes, 
                                 SdaiAttr          attributeIds[],
                                 SdaiSelect        attributeValues[], 
                                 SdaiOptions       options, 
                                 SdaiInvocationId  *edmiInvocationId);   


Assigns values to one or more of the attributes of a specified instance. This operation is applicable only to Explicit attributes, not to Inverse or Derive attributes. The attributes are identified by their attributeIds.

 

Arguments


TypeNameComment
SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

SdaiAppInstance

instance

A numeric instanceID that uniquely identifies an instance in the remote  EDMdatabase

SdaiInteger

attributes

The number of attributes for which to assign values.

SdaiAttr

attributeIds[]

A buffer of attributeIds. Each attributeId identify an attribute of the given instance for which a value is to be assigned.

SdaiSelect

attributeValues[]

A buffer of tSdaiSelect structures. Each structure must contain the value to assign to the corresponding attribute.

SdaiOptions

options

Currently not used.

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


 

 #define S_NAT 0
 #define S_PHONE 1
 #define S_NATTR 2
 int i;
 EdmiError rstat;
 SdaiServerContext myContext;
 SdaiInteger index, nHits;
 SdaiAttr attrIds[S_NATTR];
 tSdaiSelect sel[S_NATTR];
 SdaiSelect attrVals[S_NATTR] = {&sel[S_NAT], &sel[S_PHONE]};
 SdaiQueryResult qexRes; 
  
 /* Create Server Context */ 
 rstat = edmiDefineServerContext("MyContext",
 "Johnny", "Supervisor", "cf37ftr", 
 "TCP", "9090", "MyServerHost", 
 NULL, NULL, NULL, NULL, NULL, &myContext); 
  
 /* Get the persons nationality attribute ID */
 rstat = edmiRemoteGetAttrDefinitionBN(myContext, "MySocialRelations",
 "Person", "NATIONALITY", &attrIds[S_NAT], NULL); 
  
 /* And his phone number attribute ID */
 rstat = edmiRemoteGetAttrDefinitionBN(myContext, "MySocialRelations",
 "Person", "PHONE_NO", &attrIds[S_PHONE], NULL); 
  
 /* Select all person instances */ 
 rstat = edmiRemoteSelectInstances(myContext, "MyRepository", 
 "MySocialRelations", "Person", 
 NULL, ONLY_INSTANCE_IDS, NULL, NULL, NULL, 
 &index, &nHits, &qexRes, NULL, NULL, NULL, NULL); 
  
 /* Get nationality and phone number */
 for (i=0;i<nHits;i++) {
 char _phoneNumber[12];
 rstat = edmiRemoteGetAttrsEx(myContext, 
 qexRes->instanceIds[i], 0, S_NATTR,  
 attrIds, &attrVals[0], GET_ATTRS, NULL); 
  
 /* Set correct nationality code */ 
 if (! strcmp(attrVals[S_NAT]->value.enumVal, "NOR")) { 
 strcpy(_phoneNumber, "+47-"); 
 } else if (! strcmp(attrVals[S_NAT]->value.enumVal, "SWE")) { 
 strcpy(_phoneNumber, "+44-"); 
 } else if (! strcmp(attrVals[S_NAT]->value.enumVal, "DEN")) { 
 strcpy(_phoneNumber, "+45-"); 
 } else { 
 strcpy(_phoneNumber, "+??-"); 
 } 
  
 /* Concatenate the original phone number */ 
 strcat(_phoneNumber, attrVals[S_PHONE]->value.stringVal); 
  
 /* Free allocated strings in the 
 select buffers */ 
 edmiFree(attrVals[S_NAT]->value.enumVal); 
 edmiFree(attrVals[S_PHONE]->value.stringVal); 
  
 /* Put back the extended phone number */ 
 attrVals[S_PHONE]->value.stringVal = _phoneNumber; 
 rstat = edmiRemotePutAttrsEx(myContext, qexRes->instanceIds[i], 1,  
 &attrIds[S_PHONE], &attrVals[S_PHONE], 0, NULL); 
 }
 edmiFreeQueryResult(qexRes);
 . . .

 

See also

Filter by label

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