company logo

Property :: key - Extract key value

The function provides access to the key value for a key definition passed in sKeyName or the currently selected sort order (access key).

Return value:  Key value ( odaba::Key  )

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

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

// key: name;first_name

Miller;Paul          // simple positioned OIF key

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

Implementation overview

Implementation details

  1. Set key value
    odaba::Key Property  :: key ( odaba::String &sKeyName, odaba::Key &cKey )

    The key value passed in vKey is stored to the component attributes of the key definition passed in sKeyName in the currently selected instance of the property handle. The function returns the old key value before being changed.

    When no instance is selected or when no such key is defined for the structure the function throws an exception.

    • sKeyName - Key name

      The key name must be the name of a key defined for the given structure. Thekey name is passed as string with maximum 40 characters.

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

    • cKey - Key value

      A key value is the key definition and a value for the key. The key value is typically provided in ESDF format. Other formats might be set (OIF, XML)

  2. to list
  3. Extract value for passed key
    odaba::Key Property  :: key ( odaba::String &sKeyName )

    The function extracts the key value for the key passed to the function (sKeyName). The key name passed in sKeyName has to refer to a key definition for the type definition of the property handle but not necessarily to an index definition of the current collection.

    When an instance is located in the property handle but no instance has been selected, the function will select the instance located before extracting the key value.

    When no instance is located or no nstance could be selected, the function throws an exception.

    • sKeyName - Key name

      The key name must be the name of a key defined for the given structure. Thekey name is passed as string with maximum 40 characters.

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

  4. to list
  5. Get key at position
    odaba::Key Property  :: key ( int32 iPosition )

    The function returns the key value for the selected index (access key) at position passed in iPosition. The function does not read the instance but takes the key value from the index.

    • iPosition - Position in collection

      The position of an element in a collection is beginning with 0 for the first element.

  6. to list