You are here: Attributes > ListSorter

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.

Input Ports

Output Ports

Parameters

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

Additional Resources

More Information on Lists

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

Attributes

Search FME Knowledge Center

Search for samples and information about this transformer on the FME Knowledge Center.