FME Transformers: 2024.2

Categories
Attributes
Related Transformers
Sorter
SpatialSorter

ListSorter

Sorts the elements of the given list. The sorting can either be alphabetic or numeric, and in either ascending or descending order.

Null, missing, and empty values are considered to be the 'lowest' elements in both numeric and alphabetic sorting.

Examples

If an input feature had these attributes:

somelist{0} = 3

somelist{1} = 17

somelist{2} = 4

somelist{3} = 9

somelist{4} = 2

and the list name is set to somelist{}, then the feature leaving the transformer will have these attributes:

somelist{0} = 2

somelist{1} = 3

somelist{2} = 4

somelist{3} = 9

somelist{4} = 17

Note that if there were other attributes in the list "parallel" to the attribute being operated on, these will also be moved in the list to stay in "parallel" with the key attribute.

For example, if the input feature had these attributes:

somelist{0}.kind = 'paved'

somelist{0}.count = 3

somelist{1}.kind = 'smooth'

somelist{1}.count = 17

somelist{2}.kind = 'trail'

somelist{2}.count = 4

somelist{3}.kind = 'rough'

somelist{3}.count = 9

somelist{4}.kind = 'logging'

somelist{4}.count = 2

and the list name is set to somelist{}.count, then the feature leaving the transformer will have these attributes:

somelist{0}.kind = 'logging'

somelist{0}.count = 2

somelist{1}.kind = 'paved'

somelist{1}.count = 3

somelist{2}.kind = 'trail'

somelist{2}.count = 4

somelist{3}.kind = 'rough'

somelist{3}.count = 9

somelist{4}.kind = 'smooth'

somelist{4}.count = 17

Lastly, if the original list was sparse, that is, it was missing some elements, the sorting operation will have the side effect of compacting the list to make all elements have consecutive indices. For example, if the input feature had these attributes:

somelist{0}.kind = 'paved'

somelist{0}.count = 3

somelist{3}.kind = 'rough'

somelist{3}.count = 9

somelist{4}.kind = 'logging'

somelist{4}.count = 2

and the list name is set to somelist{}.count, then the feature leaving the transformer will have these attributes:

somelist{0}.kind = 'logging'

somelist{0}.count = 2

somelist{1}.kind = 'paved'

somelist{1}.count = 3

somelist{2}.kind = 'rough'

somelist{2}.count = 9

Configuration

Input Ports

Output Ports

Parameters

Additional Resources

More Information on Lists

Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.

FME Community

The FME Community has a wealth of FME knowledge with over 20,000 active members worldwide. Get help with FME, share knowledge, and connect with users globally.

Search for all results about the ListSorter on the FME Community.