company logo

Property :: previousKey - Locate previous key value

The function tries to locate the previous key value according to the selected access key starting at the located instance or a key offset.

The function locates the key value previous to the offset or currently located instance. The function returns the previous key value located. When calling the function for indexes allowing duplicate key values, previousKey() also returns duplicates.

When a filter or key filter has been set, the function locates the previous key value or instance fulfilling the filter condition.

Usually, the instance will be located but not positioned. In case of instance filters or unordered collections, however, the instance will be selected. In order to select the instance located one may call get().

The function returns the key value. When no instance could be located, when no key is defined (e.g. for untyped collections), or when an error occurred while reading data, the function throws an exception.

Return value:  New key value for instance ( odaba::Key  )

The key passed for renaming the instance must be structured according to the currently selected sort order. Key components within a key must be separated by '|' or ';'. An empty string can be passed in order to indicate no key value.

In order to pass no key value, an empty string ( String() ) has to be passed.

Implementation overview

Implementation details

  1. Locate previous key value from current position
    odaba::Key Property  :: previousKey (  )

    The function locates the previous key value starting as current position (last instance located). When no instance is located, the function returns the last key.

  2. to list
  3. Locate previous key value for passed offset
    odaba::Key Property  :: previousKey ( odaba::Key vSortKey )

    The function tries to locate the previous key value starting at key offset passed in vSortKey.

    • vSortKey - Access key

      The sort or access key value is provided as typed string in ESDF or CSV format. Key components can be separated by '|' or ';'.

      // key: name;first_name

      Miller;Paul          // simple positioned CSV key

      "Miller";"Paul Mary" // special characters must be quoted

  4. to list
  5. Locate previous key value from offset on key level
    odaba::Key Property  :: previousKey ( odaba::Key vSortKey, int32 iKeyLevel )

    The function tries to locate the previous key value starting at key offset passed in vSortKey.

    The switch level (iKeyLevel) allows defining the last key components that must alter. This allows e.g. reading all key values without duplicates when fixing the last key component.

    • vSortKey - Access key

      The sort or access key value is provided as typed string in ESDF or CSV format. Key components can be separated by '|' or ';'.

      // key: name;first_name

      Miller;Paul          // simple positioned CSV key

      "Miller";"Paul Mary" // special characters must be quoted

    • 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.

  6. to list
  7. Locate previous instance for key level
    odaba::Key Property  :: previousKey ( int32 iKeyLevel )

    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.

  8. to list