Property :: previous - Try selecting previous instance in collection
The function locates and reads the previous instance in a collection starting from the currently located one. When no instance is located, the function selects the last valid instance.
When a filter has been defined for the collection, the function returns the previous valid instance according to the filter condition.
The function returns true , when previous instance has been located successfully. Otherwise it returns false . In case of read errors or when the property handle is not accessible the function throws an exception.
Since error handling in previous() loops becomes difficult, a better way of iterating through a collection is often using get( iPosition ) or getRelative( iPosition ) and count() or relativeCount() in order to determin the size of collection.
The value is true when the function was executed successfully. Otherwise the value is set to false .
Implementation overview
- Locate previous instance
Property :: previous (  ) - Locate previous instance for key level
Property :: previous ( iKeyLevel, bRead ) - Locate and read previous instance
Property :: previous ( bRead )
Implementation details
-
Locate previous instance
bool Property  :: previous (  )
The function locates the previous instance in the property handle without reading it. The instance might be selected when a filter has been set for the property handle.
In order to make sure that the instance is selected, one may call get() or previous(true).
to list
-
Locate previous instance for key level
bool Property  :: previous ( int32 iKeyLevel, bool bRead )
The switch level ( iKeyLevel ) allows defining the last key components that must alter. This allows e.g. providing all instances without duplicate key values, when fixing the last key component.
- iKeyLevel
- Number of fixed key component
The switch level defines the key component number that need not change when calling next() or locateKey() beginning with 1 for the first key component.
- bRead
- Read option
The option forces the function to read the instance when it could be located.
to list
- iKeyLevel
- Number of fixed key component
-
Locate and read previous instance
bool Property  :: previous ( bool bRead )
The function locates and reads the previous instance, when passing true in bRead . When passing false , the function tries to locate the instance without reading.
- bRead
- Read option
The option forces the function to read the instance when it could be located.
to list
- bRead
- Read option