Skip to main content
Solved

how to reorder values in some cells ?

  • March 22, 2024
  • 1 reply
  • 59 views

soly
Contributor
Forum|alt.badge.img+3
  • Contributor

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.

 

View original
Did this help you find an answer to your question?

1 reply

geomancer
Evangelist
Forum|alt.badge.img+47
  • 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.

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings