company logo

Property :: group - Grouping operation (not yet implemented)

The grouping operation allows grouping a collection of instances according to a list of attributes. In order to refer to derived attributes, attribute definitions may be extended by a source operand. The instances grouped are collected in a property named partition , which has the same type as the input collection for the operation.

The output contains the attributes defined in the attribute list. Attributes in the defined order provide a unique sort key definition.

When the grouping property handle (calling property handle) refers to a non empty collection all instances are removed before performing the operation. When the calling property handle is not opened, the function creates a temporary extend for storing the result. You may change the buffer size for the target property handle in order to increase the performance of the operation. This is not necessary, when grouping by access key attributes.

Notes:

The function is not yet implemented. Implementation is planned for version 14.

Return value:  Result property handle ( odaba::Property & )

Reference to the property handle that contains the result of an operation. Note that invalid properties may cause exceptions.

Implementation details

  1. Default group operation
    odaba::Property & Property  :: group ( odaba::Property &cProperty, odaba::String &vGroupingRule )

    The function associates instances with each value that matches the condition, which might create duplicates. In order to avoid duplicates, the distinct group operation needs to be called ( group( property , rule , true ) ).

    • cProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • vGroupingRule - Grouping rule

      The grouping rule describes the grouping strategy. You may either group instances according to the values for a list of attributes or a key, which is considered as attribute list as well (country, city). You may also define attribute values by means of conditions.

      In order to pass no grouping rule, an empty string ( String() ) may be passed.

  2. to list
  3. Distinct group operation
    odaba::Property & Property  :: group ( odaba::Property &cProperty, odaba::String &vGroupingRule, bool bDistinct )

    When defining conditional values and when passing bDistinct true , the instance is associated with the first value, that matches the condition. Otherwise, the instance is associated with each value that matches the condition, which might create duplicates.

    • cProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • vGroupingRule - Grouping rule

      The grouping rule describes the grouping strategy. You may either group instances according to the values for a list of attributes or a key, which is considered as attribute list as well (country, city). You may also define attribute values by means of conditions.

      In order to pass no grouping rule, an empty string ( String() ) may be passed.

    • bDistinct - Distinct option

      Passing a distinct option true forces the function to remove (or not to store) duplicates from the result collection.

  4. to list