sdaiPutAttrs


Assigns the specified value to the specified Explicit attributes in the specified instance. This operation is applicable only to Explicit attributes, not to Inverse or Derive attributes.
This operation is the same as the sdaiPutAttr operation except that this operation can assign values to any number of attributes in one invocation. For each attribute to assign value to the following three arguments must be specified:

  1. <attributeID> : A numeric attributeID that uniquely identifies an attribute definition instance in the EDMdatabase, hence defines the attribute to assign the specified value to.
  2. <valueType> : The specified primitive typesdai_primitive_types <valueType> must be the same or a compatible data type of the actual attribute domain as defined in the attribute declaration in the related EXPRESS schema.

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. 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.

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

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: sdaiPutAttr , sdaiPutAttrBN , sdaiPutAttrsBN
Header:
#include "sdai.h"
Prototype:
void sdaiPutAttrs(SdaiAppInstance   instance,
                   SdaiInteger       numberAttrs, 
                   /* [SdaiAttr attrId, 
                   SdaiPrimitiveType dataType, 
                   void dataValue,] */ 
                   ...); /* values */ 
Arguments:

instance

A numeric instanceID that uniquely identifies an instance in the EDMdatabase.
The instanceID is defined by a sdaiCreateInstance or a sdaiCreateInstanceBN function.

numberAttrs

An integer number that specifies the number of attributes that will be assigned a value in this operation.

values

For each attribute value to assign the three following arguments in the following order have to be specified:

  1. SdaiAttr attributeID: A numeric identifier that uniquely identifies an attribute definition instance in the EDMdatabase, hence defines the attribute within the specified instance to assign the specified value to. The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions.
  2. <valueType> : The specified primitive type <valueType> must be the same or a compatible data type of the actual attribute domain as defined in the attribute declaration in the related EXPRESS schema.

    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. 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.
  3. value : The data value to assign to the actual attribute in the specified instance. The type of <value> must be the same as specified in the <valueType> argument.

Returns:
Void – use sdaiErrorQuery to check for error in operation.
Examples:
SdaiInstance instanceId;
SdaiAttr attr1_def, attr2_def, attr3_def;
SdaiErrorCode errCode;
...
sdaiPutAttrs(instanceId, 2,
attr1_def, sdaiSTRING, "Hello world",  
attr2_def, sdaiREAL, 3.14); 
if (errCode = sdaiErrorQuery()) {
/* Error in operation */ 
printf("\nError: %s in sdaiPutAttrs \n", 
edmiGetErrorText(errCode)); 
goto error; 
}
. . .
sdaiPutAttrs(instanceId, 3,
attr1_def,sdaiBOOLEAN, sdaiTRUE,  
attr2_def, sdaiINTEGER, 60,
attr3_def, sdaiINTEGER, 96); 
...