Detailed Description of Group Selector

This step creates groups of records based on specified key definitions. The step will select records from each group based on specified criteria. Records can be selected multiple times based on different criteria. The resulting records of selection criteria for each group may be dependent on sort order. For example when selecting the first N records, the sort order of the group determines which records will be selected.

Selection/Grouping Methods:

all

Select all records of a group.

min

Select the first N (count) records of a group.

max

Select the last N (count) records of a group.

median

Select the middle N (count) records of a group.

proportional

Select N (count) uniformly distributed count records of a group.

mincard

Select all group records where each group has at least N (count) records.

maxcard

Select all group records where each group has at most N (count) records.



Example: Example
<step id="alg" className="cz.adastra.cif.tasks.experimental.select.GroupSelectorEngine" >
        <properties>
            <gs_group>groupName</gs_group>
            <gs_select>selectionName</gs_select>
                <groups>
                        <!-- Physical persons are grouped by client ket/id -->
                        <group when="std_client_type = 'FO' and not unify_role in ('N','R')" name="fo">
                                <components>
                                        <component expression="client_id" />
                                </components>
                                <results>
                                        <!-- select first 2 and last 2 (best and worst by score) records for each group -->
                                        <result>
                                                <selections>
                                                        <selection name="best-2" count="2" method="min"/>
                                                        <selection name="worst-2" count="2" method="max"/>
                                                </selections>
                                                <sorting>
                                                        <orderBy expression="score_instance" />
                                                </sorting>
                                        </result>
                                        <!-- select 3 middle records for each group -->
                                        <result>
                                                <selections>
                                                        <selection name="medium_bd" count="3" method="median"/>
                                                </selections>
                                                <sorting>
                                                        <orderBy expression="std_birth_date" />
                                                </sorting>
                                        </result>
                                </results>
                        </group>
                        <!-- legal entities are grouped by candidate key/id -->
                        <group when="std_client_type = 'PO'" name="po">
                                <components>
                                        <component expression="candidate_id" />
                                </components>
                                <results>
                                        <!-- groups with at least 3 members are selected -->
                                        <result>
                                                <selections>
                                                        <selection name="atleast-3" count="3" method="mincard"/>
                                                </selections>
                                        </result>
                                </results>
                        </group>
                </groups>
                <commonResults>
                        <!-- from all groups selected the most recently updated record -->
                        <result>
                                <selections>
                                        <selection name="last-update" count="1" method="max"/>
                                </selections>
                                <sorting>
                                        <orderBy expression="update_time" />
                                </sorting>
                        </result>
                </commonResults>
        </properties>
</step>

iWay Software