company logo

PropertyHandle :: GetRelativeIndex - Get relative position of current or last instance

The function returns the relative position of the current or last instance. This may differ from the absolute (current) position in case of filter conditions or selection by context handlers.

When no instance is selected or when no relative position is known for the instance currently selected (e.g. when selected by key), the function return AUTO. When passing last_opt YES, the function returns the last relative index found for the property handle.

The relative index is updated only, when using the GetRelative() function for accessing the collection.

Return value:  Position in collection ( int32  )

The position of an instance in a collection depends on the selected index. if the collection is unsorted the position is the only way for accessing the instance.

For sorted collections the position is determined according to the instance key. If is a contradiction between position and key value the position will be ignored.

Special positions are

CUR_INSTANCE (-1) refers to the currently selected instance. If no instance is selected it refers to the first instance.

FIRST_INSTANCE (0) refers to the first instance in a collection according to the selected index (sort order).

FIRST_INSTANCE (0x7fffffff) refers to the last instance in a collection according to the selected index (sort order).

Implementation details

int32 PropertyHandle  :: GetRelativeIndex ( logical last_opt )
  • last_opt - Returns last relative index

    When this option is set, the value contains the last relative index stored for the property handle, which may differ from the currently selected instance.