sdaiCreateIterator


Creates a new iterator and connects the created iterator to the specified aggregate.
An iterator is an element position pointer in an aggregate. An iterator can be connected to all types of aggregates. The aggregate element pointed to by the iterator is called the current element of the iterator. Initially the created iterator is positioned at the beginning of the aggregate, i.e. before the first element in the aggregate. Hence, there is no current element of the actual iterator. The first subsequent sdaiNext operation will position the iterator to the first element in the connected aggregate.
A numeric iteratorID that uniquely identifies the created iterator in the actual _EDMserver_ session is returned. This iteratorID should be used in subsequent EDMinterface operations to identify the actual iterator within the same _EDMserver_ session. All iterators created within an open _EDMserver_ session will be deleted when the actual _EDMserver_ session is closed and the actual iterator has not been deleted by the sdaiDeleteIterator function.
An iteratorID is local to the application that creates the iterator.
Related functions: sdaiDeleteIterator , sdaiBeginning , sdaiNext , sdaiPrevious , sdaiEnd , sdaiGetAggrByIterator , sdaiPutAggrByIterator , sdaiUnsetAggrByIterator , edmiTestAggrByIterator , sdaiCreateNestedAggrByIterator , sdaiInsertBefore sdaiInsertAfter , sdaiRemove , sdaiDelete .
Header:
#include "sdai.h"
Prototype:
SdaiIterator sdaiCreateIterator(SdaiAggr aggregate);
Arguments:

aggregate

A numeric aggregateID that uniquely identifies the aggregate instance in the EDMdatabase that will be connected to the created iterator.
The aggregateID is returned when the aggregate is created or it can be retrieved by an _EDMinterface_ get operation.

Returns:
A numeric iteratorID that uniquely identifies the new created iterator in the actual open _EDMserver_ session. This iteratorID should be used to identify the particular iterator in subsequent EDMinterface operations within the same open _EDMserver_ session.
iteratorID != 0 : operation successfully performed.
iteratorID = 0 : operation failed, use sdaiErrorQuery function to get error reason.
Example:
SdaiIterator iterId;
SdaiAggr aggregate;
...
iterId = sdaiCreateIterator(aggregate);
if (! iterId) {
/* Error in operation */ 
printf("\nError: %s in sdaiCreateIterator \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 
}
. . .