Solved
Alphanumeric sorting in ListRangeExtractor
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!
Best answer by takashi
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.
- ListCopier: Copy the original list "list{}" to "tmp{}".
- ListRenamer: Rename "tmp{}.lbl" to "list{}.xxx".
- ListStringReplacer (FME Store): Remove every non-digit from every element of "list{}.xxx".
- ListSorter: Sort "list{}.xxx" by numeric ascending.
- LIstIndexer: Demote the first element of "list{}.lbl" (List Index: 0), adding a prefix "min_".
- ListIndexer_2: Demote the last element of "list{}.lbl" (List Index: -1), adding a prefix "max_".
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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.




