sdaiPutAttr


Assigns the specified value to the specified explicit attribute in the specified instance. This operation is applicable only to Explicit attributes, not to Inverse or Derive attributes.
The data type, i.e. primitive type of the value, and the data value to be assigned to the actual attribute in the specified instance are specified as arguments to this function.
The data type specified in the <valueType> argument must be the same or a compatible type to the actual attribute domain defined in the attribute declaration in the EXPRESS schema that defines the attribute. All data types except sdaiAGGR can be handled by this operation. Aggregates cannot be assigned as attribute data value by this operation. Aggregates must be assigned to attributes by either sdaiCreateAggr or sdaiCreateAggrBN operations.
This operation is only applicable to Explicit attributes in application instances.
The model that holds the actual instance must be open for write access before this operation can be successfully performed.
Related functions: sdaiPutAttrBN , sdaiPutAttrs , sdaiPutAttrsBN
Header:
#include "sdai.h"
Prototype:
void sdaiPutAttr(SdaiAppinstance  appinstance,
                  SdaiAttr         attribute, 
                  SdaiPrimitive    valueType, 
                    ...); 
Arguments:

appinstance

A numeric instanceID that uniquely identifies the application instance in the EDMdatabase that will receive the new attribute value.
The instanceID is defined by a sdaiCreateInstance or a sdaiCreateInstanceBN function.

attribute

A numeric attributeID that uniquely identifies the attribute definition instance in the EDMdatabase that defines the actual attribute in the instance <appinstance> that will receive the specified value. The actual attribute must be an Explicit attribute.
The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions.

valueType

The data type, i.e. the primitive type of the data value to assign to the specified attribute in the specified instance. This <valueType> must be the same or a compatible type of the attribute domain as defined in the related EXPRESS schema. The primitive type sdaiSELECT can be used to write all data types. The primitive type sdaiADB can be used to write all data types except typed values.
The primitive type sdaiINTEGER is compatible with sdaiREAL, and sdaiBOOLEAN is compatible with sdaiLOGICAL, hence conversion between these compatible data types will be performed when required.
An aggregate, i.e. data type sdaiAGGR is illegal in this operation.

value

The actual value to assign to the specified attribute in the specified instance. The type of <value> must be the same as specified by the <valueType> argument.

Returns:
Void – use sdaiErrorQuery to check for error in operation.
Example:
SdaiAppinstance anInst;
SdaiAttr attr;
...
sdaiPutAttr(anInst, attr, sdaiINTEGER, 1234560);
if (errCode = sdaiErrorQuery()) {
/* Error in operation */ 
printf("\nError: %s in sdaiPutAttr \n", 
edmiGetErrorText(errCode)); 
goto error; 
}
. . .