edmiRemotePutAttrsBNEx
EdmiError edmiRemotePutAttrsBNEx(SdaiServerContext serverContextId, SdaiAppInstance instance, SdaiInteger attributes, SdaiString attributeNames[], 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 names.
Â
Arguments
Type | Name | Comment |
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. |
SdaiString | attributeNames[] | A buffer of string pointers. Each pointer represents the name of an attribute 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
Â
Options
 Â
Â
Example
Â
#define S_NAT 0 #define S_PHONE 1 #define S_NATTR 2 int i; EdmiError rstat; SdaiServerContext myContext; SdaiInteger index, nHits; SdaiQueryResult qexRes; /* Create Server Context */ rstat = edmiDefineServerContext("MyContext", "Johnny", "Supervisor", "cf37ftr", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &myContext); /* 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]; SdaiString _attrNames[S_NATTR] = {"NATIONALITY", "PHONE_NO"}; tSdaiSelect _sel[S_NATTR]; SdaiSelect _attrVals[S_NATTR] = {&_sel[S_NAT], &_sel[S_PHONE]}; rstat = edmiRemoteGetAttrsBNEx(myContext, qexRes->instanceIds[i], 0, S_NATTR, _attrNames, &_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 = edmiRemotePutAttrsBNEx(myContext, qexRes->instanceIds[i], 1, &_attrNames[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.
Â