sdaiPutAggrByIndex
Writes the specified value to the specified aggregate element.
The data type, i.e. primitive type of the value, and the data value to be written in the actual aggregate element are specified as arguments to this function.
This operation is applicable to ordered aggregates, i.e. ARRAY and LIST type aggregates. The actual aggregate element is specified by the element index. Element index zero is the lowest index in a LIST, hence the legal indexes for a LIST are: 0 <= index <= number of elements in LIST. The legal index range for ARRAY is as found in the actual ARRAY declaration in the related EXPRESS schema.
This operation is applicable to ARRAY and LIST aggregates owned by application instances.
The model that holds the actual aggregate must be open for write access before this function can be successfully performed.
Related functions: sdaiAppend , sdaiPrepend , sdaiInsertAfter , sdaiInsertBefore, sdaiPutAggrByIterator , edmiWriteAggrElements
Header:
#include "sdai.h"
Prototype:
void sdaiPutAggrByIndex(SdaiOrderedCollection aggregate,
SdaiInteger index,
SdaiPrimitiveType valueType,
...);
Arguments:
aggregate |
A numeric aggregateID that uniquely identifies an aggregate instance in the EDMdatabase that will receive the specified value. The actual aggregate must be an ordered aggregate, i.e. either an ARRAY or a LIST aggregate. |
index |
An integer that denotes the aggregate element index in the aggregate to write the specified data value in. |
valueType |
The data type, i.e. the primitive type of the data value to write in the specified aggregate element. This <valueType> must be the same or a compatible type of the primitive type of the value in the actual aggregate elements 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. |
value |
The actual value to write in the specified aggregate element. 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:
SdaiAggr aggregate;
SdaiErrorCode errCode;
...
sdaiPutAggrByIndex (aggregate, 1, sdaiSTRING, "xcbv123");
if (errCode = sdaiErrorQuery()) {
/* Error in operation */
printf("\nError: %s in sdaiPutAggrByIndex \n",
edmiGetErrorText(errCode));
goto error;
}
. . .