company logo

PropertyHandle :: Group - Grouping operation

The grouping operation allows grouping a collection of instances according to a condition, key or list of attributes. The instances grouped are collected in a property named "partition", which has the same type as the input collection for the operation.

When defining conditional values in the grouping rule, a string attribute named "value" is created for each output instance. Otherwise, the output contains the attributes defined in the attribute list or composing the key. When passing an OSI expression as grouping rule, the type of the attribute in the target depends on the type returned by the expression.

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

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

Return value:  Success ( logical  )

Implementation details

logical PropertyHandle  :: Group ( PropertyHandle &prophdl_ref, NString &grouping_rule, logical distinct=NO )
  • prophdl_ref - Reference to Property handle
  • grouping_rule - 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.

  • distinct - Distinct option

    Passing a distinct option YES forces the function to remove duplicates from the result collection.

    Default: NO