ListSorter
Sorts the elements of the given list. The sorting can either be alphabetic or numeric, and in either ascending or descending order.
Input Ports
Features containing a list attribute to be sorted.
Output Ports
Features containing the sorted list attribute.
Parameters
The name of the list that will be sorted by this transformer.
- Alphabetic: The elements in the list are treated as text when they are sorted.
- Numeric: The elements in the list are sorted based on their numeric values.
- Ascending: Elements in the sorted list are arranged so that smaller elements come before larger elements.
- Descending: Elements in the sorted list are arranged so that larger elements come before smaller elements.
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{3}.kind = 'rough'
somelist{3}.count = 9
Additional Resources
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Transformer Categories
Search FME Knowledge Center
Search for samples and information about this transformer on the FME Knowledge Center.