Skip to main content
Gathering Interest

ListSorter to support multiple sort-by criteria

Related products:Transformers
  • June 8, 2018
  • 7 replies
  • 70 views

david_r
Celebrity

I would like the ListSorter to support multiple sort-by criteria, similar to the regular Sorter. Example:

Currently (FME 2018.0.1) you cannot use multiple ListSorters to accomplish the same thing, since the ListSorter doesn't preserve the existing item order on duplicate sort keys (PR83992).

7 replies

Forum|alt.badge.img
  • February 21, 2019

Hi David,

Is it a list you have built (e.g. with an Aggregator) ? I have this case, and this is the way I proceed. I have to sort my datas by priority (attribute PRIORITE) then by date (attribute DATE).

I use a Sorter with these two criterias BEFORE the Aggregator so my datas are already sorted after the Aggregator.

Is it what you want to do ? But I have to admit that a mutiple sort-criteria would be great !

Best regard

Patrick


david_r
Celebrity
  • Author
  • February 21, 2019

Sorting the data before list generation isn't always feasible, unfortunately, as the input sort order isn't always guaranteed on the output list. You may also want to sort by an attribute that was introduced by the transformer generating the list, e.g. the NeighborFinder.


tomw202
Contributor
Forum|alt.badge.img+4
  • Contributor
  • December 18, 2019

This would be really useful!


chriswilson
Enthusiast
Forum|alt.badge.img+22
  • Enthusiast
  • January 7, 2020

I'd say this is a no-brainer, it would be great to have the option to examine the list in this way without having to explode and then sort on a secondary attribute.


david_r
Celebrity
  • Author
  • January 8, 2020

Hopefully someone with the "power of the purse" at Safe will agree soon as well ;-)


jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • September 29, 2023

As far as I can tell, if you chain a set of ListSorters in order of increasing priority you get the correct results.

ie. if you want to sort on attribute A then B you would have two listSorters, the first on B and the 2nd on A.

I haven't tried this with 3 or more, and it would be much nicer if we could have the same functionality as the sorter, where we just add as many criteria as we need.


LizAtSafe
Safer
Forum|alt.badge.img+21
  • Safer
  • April 6, 2026
OpenGathering Interest