Skip to main content
Solved

how to reorder values in some cells ?

  • March 22, 2024
  • 1 reply
  • 68 views

soly
Contributor
Forum|alt.badge.img+3

i have some cells contains 

Aaaa||ccc||ddd||bb||fff

i would like to reverse them in case condition happens to get 

fff|||bb||||ddd||ccc||Aaaa

FME 2021

Thanks in advance 

Best answer by geomancer

If I understand correctly, you have some data in one attribute, where you want to invert the order of the words. It is not clear why there are extra | characters in your desired results, I ignored those for now.

  1. Use an AttributeSplitter to split the attribute into a list on ||
  2. Explode the list to individual features. This gives you  an attribute _element_index that gives the order the features had in the list
  3. Sort on that attribute in descending order
  4. Aggregate the features in an Aggregator, concatenate the attribute that came from the list.

 

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.

1 reply

geomancer
Evangelist
Forum|alt.badge.img+60
  • Evangelist
  • Best Answer
  • March 25, 2024

If I understand correctly, you have some data in one attribute, where you want to invert the order of the words. It is not clear why there are extra | characters in your desired results, I ignored those for now.

  1. Use an AttributeSplitter to split the attribute into a list on ||
  2. Explode the list to individual features. This gives you  an attribute _element_index that gives the order the features had in the list
  3. Sort on that attribute in descending order
  4. Aggregate the features in an Aggregator, concatenate the attribute that came from the list.