sdaiNext
An iterator is either pointing to an element, before the first element, or after the last element in the connected aggregate. If the iterator is pointing to an aggregate element, this element is defined as the current element of the iterator. This operation positions the specified iterator to the next aggregate element immediately following the current element which will then be the new current element of the iterator after this operation is completed.
If the iterator is pointing to the start of the aggregate when this function is invoked, the first element in the actual aggregate will be the new current element of the iterator after this operation is completed. If the iterator is pointing to the end of the aggregate when this function is invoked, the function will fail.
For ordered aggregates, i.e. LIST and ARRAY the order of the aggregate elements is significant and controlled by the calling application. For unordered aggregates, i.e. BAG and SET the order of the aggregate elements is insignificant to the caller and cannot be controlled by the calling application.
The model that holds the aggregate connected to the specified iterator must be open before this operation can be successfully performed.
See related functions: sdaiCreateIterator , sdaiDeleteIterator , sdaiEnd , sdaiPrevious , sdaiBeginning
Header:
#include "sdai.h"
Prototype:
SdaiBoolean sdaiNext(SdaiIterator iterator);
Arguments:
iterator |
A numeric iteratorID that uniquely identifies an iterator in an EDMsession. |
Returns:
sdaiTRUE : The specified iterator has got a new current element.
sdaiFALSE : Error during operation - use sdaiErrorQuery to get error reason.
Example:
SdaiIterator iterator;
SdaiAggr aggrId;
SdaiInteger myInt;
...
iterator = sdaiCreateIterator (aggrId);
while (sdaiNext(iterator) == sdaiTRUE) {
p = sdaiGetAggrByIterator(iterator, sdaiINTEGER, &myInt);Â
if (p == NULL) {Â
/* Error in operation */Â
printf("\nError: %s in sdaiGetAggrByIterator \n",Â
edmiGetErrorText(sdaiErrorQuery()));Â
goto error;Â
}Â
. . .Â
}
. . .