sdaiAdd
Add an element to an unordered aggregate. Unordered aggregates are SET and BAG aggregates.
The data type, i.e. primitive type of the value, and the data value of the new element to be added to the aggregate are specified as arguments to this function.
This function is applicable to unordered 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.
See related functions: sdaiPrepend , sdaiAppend , sdaiInsertAfter , sdaiInsertBefore , sdaiPutAggrByIndex , sdaiPutAggrByIterator
Header:
#include "sdai.h"
Prototype:
SdaiBoolean sdaiAdd(SdaiUnorderedCollection aggregate,
SdaiPrimitiveType valueType,
...);
Arguments:
aggregate |
A numeric aggregateID that uniquely identifies the unordered aggregate in the EDMdatabase to add an element to. This aggregate must be a SET or a BAG. |
valueType |
Specifies the primitive type of the data value of the new element to add to the aggregate specified by the <aggregate> argument. This <valueType> must be the same or a compatible type the of the actual aggregate element primitive type 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 aggregate element value to write. The element value must be of the primitive type specified in the <valueType> argument. |
Returns:
A SdaiBoolean data type with the following values:
sdaiTRUE – function successfully performed.
sdaiFALSE- function failed, use sdaiErrorQuery function to get error reason.
Example:
SdaiBoolean result;
SdaiErrorCode errCode;
SdaiUnorderedCollection setId;
...
result = sdaiAdd(setId, sdaiSTRING, "mystring");
if (result == sdaiFALSE) {
/* Error in operation */
printf("\nError: %s in sdaiAdd \n",
edmiGetErrorText(sdaiErrorQuery()));
goto error;
}
. . .
result = sdaiAdd(bagId, sdaiREAL, 3.14);
if (result == sdaiFALSE) {
/* Error in operation */
printf("\nError: %s in sdaiAdd \n",
edmiGetErrorText(sdaiErrorQuery()));
goto error;
}
...