Skip to main content
I have list attribute list{}.lbl, where lbl has these (alphanumeric) values 3A,5,7,9,11,13,15. I need the smallest (3A) and largest (15) value. ListRangeExtractor give Resulting Minimum Attribute 3A and Resulting Maximum Attribute 7. I suppose ListRangeExtractor and I don't fully agree on sorting order of alphanumerical values, it seems like it prefer to sort it either numerical (3...15 works fine) or alphabetical. Does any expert user have a suggestion or workaround to solve this list issue? Thanks!

 

Hi!


Before having the list build, split your "lbl" (like lbl_num and lbl_alpha) and then sort list by lbl_num. Like that you will have 3 and 15 as range.


it does a ordinal ordering, not alphabetic nor numerical, when the characters are alfnumeric.

 

Wich places 15 before 7. This is normal behaviour.

 

 

Before building the list and consequentially before the listrange extractor ,i would use a sorter and sort on both components. If they are not available separate, you must first create sorting fields by splitting them.

 

 

If not possible before building the list, you still must split the listattribute, wich forces u to explode the list...

 

So i would definitely do it before listbuilding iff poss.

 


Would "3" be OK instead of "3A"? If so, I see a ListStringReplacer in the FME Store that you could use to remove the non-numeric characters first. Or at least that could be a first step to find the min/max numbers before checking for suffixes.

 


Hi,

 

 

The ListRangeExtractor cannot be used in this case.

 

"If some values are numeric and some are not, the minimum and maximum values extracted may not be useful." -- Help of the ListRangeExtractor

 

 

Expanding @markireland's suggestion, if the resulting minimum value should be "3A", this workflow is available.

 

  1. ListCopier: Copy the original list "list{}" to "tmp{}".
  2. ListRenamer: Rename "tmp{}.lbl" to "list{}.xxx".
  3. ListStringReplacer (FME Store): Remove every non-digit from every element of "list{}.xxx".
  4. ListSorter: Sort "list{}.xxx" by numeric ascending.
  5. LIstIndexer: Demote the first element of "list{}.lbl" (List Index: 0), adding a prefix "min_".
  6. ListIndexer_2: Demote the last element of "list{}.lbl" (List Index: -1), adding a prefix "max_".
You can then find two attributes - "min_lbl" storing "3A" and "max_lbl" storing "15".

 

 

However, if the "list{}.lbl" has been created in the preceding data flow in the workspace, I would consider firstly whether @francis_m and @gio's suggestion (sort before list building) can be applied.

 

Takashi

Thanks for pointing out for me that the ListRangeExtractor is either numerical OR alphabetical, not both in combination.

As my need was to maintain the alphanumeric structure I ended up with much of Takashi's structure. The numeric and alphabetical part of lbl was available, so I created a custom transformer to do the trick, with a ListSorter on the numeric part, and then two ListIndexers to extract the correct max and min values. Thanks to the rest of you for the suggestions to look for the original numerical and character parts of "lbl".


Reply