sdaiInsertBefore


Adds an element to a LIST aggregate referenced by an iterator. The new element will be inserted in the aggregate immediately before the current element of the actual iterator. The current element of the iterator is not changed by this operation. If the iterator is pointing at the end of the connected aggregate (as if the sdaiEnd operation had just been applied), the new element will become the last element in the LIST. If the iterator is pointing at the beginning of the connected aggregate (as if the sdaiBeginning operation had just been applied), this operation will fail.
The data type, i.e. primitive type of the value, and the data value of the new element to be inserted in the LIST are specified as arguments to this function.
This operation is only applicable to 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: sdaiInsertAfter , sdaiAppend , sdaiPrepend , sdaiNext , sdaiBeginning , sdaiEnd , sdaiPrevious .
Header:
#include "sdai.h"
Prototype:
void sdaiInsertBefore(SdaiIterator      iterator,
                       SdaiPrimitiveType valueType, 
                         ...); 
Arguments:

iterator

A numeric iteratorID that uniquely identifies an element in the connected aggregate in the EDMdatabase. The iteratorID is defined by the sdaiCreateIterator function.

valueType

The data type, i.e. the primitive type of the data value to be inserted in the LIST. This <valueType> must be the same or a compatible type of the primitive type 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.
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.

value

The actual value, that must be of type <valueType> or a compatible type.

Returns:
Void – use sdaiErrorQuery to check for errors during operation.
Example:
SdaiIterator iteratorId, iterator2;
SdaiErrorCode errCode;
...
sdaiInsertBefore(iteratorId, sdaiSTRING, "mystring");
if (errCode = sdaiErrorQuery()) {
/* Error in operation */ 
printf("\nError: %s in sdaiInsertBefore \n", 
edmiGetErrorText(errCode)); 
goto error; 
}
. . .
sdaiInsertBefore(iterator2, sdaiREAL, 3.14);
...