sdaiPrevious


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 aggregate element immediately before 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 end of the aggregate when this function is invoked, the last 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 beginning 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 , sdaiNext , sdaiBeginning
Header:
#include "sdai.h"
Prototype:
SdaiBoolean sdaiPrevious(SdaiIterator iterator);
Arguments:

iterator

A numeric iteratorID that uniquely identifies an iterator in an EDMsession.
The iteratorID is defined by a sdaiCreateIterator function.

Returns:
sdaiTRUE : The specified iterator have 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);
sdaiEnd(iterator);
while (sdaiPrevious(iterator) == sdaiTRUE) {
p = sdaiGetAggrByIterator(iterator, sdaiINTEGER, &myInt); 
if (p == NULL) { 
/* Error in operation */ 
printf("\nError: %s in sdaiGetAggrByIterator \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 
} 
. . . 
}
. . .