Using the Element Iterator setting "Expression for Grouping Key" (found on the "Processing | Sorting/Grouping | Grouping" tab of the Element Iterator properties dialog) you can break the iterated elements into groups so that to iterate first by the groups, and then by the elements within each group.
When the grouping key expression is specified, it works as follows.
After the initial elements have been collected, filtered and sorted, the result sequence of elements is broken into groups according to the grouping keys generated for each element by the FlexQuery specified in the "Expression for Grouping Key" of the Element Iterator.
Each continuous subsequence of elements with equal grouping keys produces a group. As a result, the sequence of elements prepared for iterations is converted into a sequence of element groups. The ordering of elements in each group remains the same as in the initial sequence.
Since groups are not elements, the Element Iterator cannot iterate by them directly.
So, it will iterate by the first elements taken from each group.
However, at that, on each iteration step, the
iterator.groupElements
property will be updated so as
to provide the enumeration of all elements in the given group.
This allows you to specify a nested iterator that will iterate by the elements in the group.
In the simplest case, the iteration scope of the nested Element Iterator should be specified as custom with the following Expression for Element Enumeration:
parentIterator.groupElements
GOMIterator.groupElements
property are also possible.)
Notes:
GOMIterator.groupElements
property returns a new element enumeration
each time it is accessed. But, the elements contained in the enumeration will be the same.
This allows you to specify several nested sibling Element Iterators (within the same parent one)
to iterate the elements of the same group in different ways.