To use sorted input, you pass sorted data through the Aggregator.
Data must be sorted in the following ways:
By the Aggregator group by ports, in the order they appear in the Aggregator transformation.
Using the same sort order configured for the session. If data is not in strict ascending or descending order based on the session sort order, the Integration Service fails the session. For example, if you configure a session to use a French sort order, data passing into the Aggregator transformation must be sorted using the French sort order.
For relational and file sources, use the Sorter transformation to sort data in the mapping before passing it to the Aggregator transformation. You can place the Sorter transformation anywhere in the mapping prior to the Aggregator if no transformation changes the order of the sorted data. Group by columns in the Aggregator transformation must be in the same order as they appear in the Sorter transformation.
If the session uses relational sources, you can also use the Number of Sorted Ports option in the Source Qualifier transformation to sort group by columns in the source database. Group by columns must be in the same order in both the Aggregator and Source Qualifier transformations.
The following mapping shows a Sorter transformation configured to sort the source data in ascending order by ITEM_NO:
The Sorter transformation sorts the data as follows:
With sorted input, the Aggregator transformation returns the following results: