Altova MapForce 2025 Professional Edition

To sort input data based on a specific sort key, use a Sort component. The Sort component supports the following target languages: XSLT2, XQuery, and Built-in. When the transformation language is "Built-in", the Sort component can be used to sort database table data. Better performance is, however, achieved using an SQL-WHERE/ORDER component. For more details, see Filtering and Sorting Database Data (SQL WHERE/ORDER).

To add a sort component to the mapping, do one of the following:

Right-click an existing connection, and select Insert Sort: Nodes/Rows from the context menu. This inserts the Sort component and automatically connects it to the source and target components. For example, in the mapping below, the Sort component was inserted between a variable and an XML component. The only thing that remains to be connected manually is the sorting key (the field by which you want to sort).

mf_sort_adding1

On the Insert menu, click Sort (alternatively, click the Sort ic-sort toolbar button). This inserts the Sort component in its "unconnected" form.

sort-unconn

As soon as a connection is made to the source component, the title bar name changes to that of the item connected to the nodes/rows item.

To define the item by which you want to sort:

Connect the item by which you want to sort to the key parameter of the Sort component. For example, in the mapping below, the Person nodes/rows are sorted by the field Last.

mf_sort_adding2

To change the sort order:

Click the ic-sort-aZ icon in the Sort component. It changes to ic-sort-Za to show that the sort order has been reversed.

To sort input data consisting of simple type items:

Connect the item to both the nodes/rows and key parameters of the sort component. In the mapping below, the element of simple type first is being sorted.

sort-eg-branchOffSimple

To sort strings using language-specific rules:

Double-click the header of the Sort component to open the Sort Properties dialog box.

mf_sort_unicode

Unicode codepoint collation: This (default) option compares/orders strings based on code point values. Code point values are integers that have been assigned to abstract characters in the Universal Character Set adopted by the Unicode Consortium. This option allows sorting across many languages and scripts.

 

Language-specific collation: This option allows you to define the specific language and country variant you want to sort by. This option is supported when using the BUILT-IN execution engine. For XSLT, support depends on the specific engine used to execute the code.

© 2018-2024 Altova GmbH