Skip to main content

You could also consider using an AttributeSplitter, split based on space character: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/attributesplitter.htm

Then expose the list element containing the second last word, using the AttributeCreator or AttributeManager. For example expose list element 3, list{2} and rename to a suitable attribute name.


You could also consider using an AttributeSplitter, split based on space character: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/attributesplitter.htm

Then expose the list element containing the second last word, using the AttributeCreator or AttributeManager. For example expose list element 3, list{2} and rename to a suitable attribute name.

Good suggestion @NatalieAtSafe.

 

As an addition: the second last word will be list element -2 (e.g list{-2}).

 


You could also consider using an AttributeSplitter, split based on space character: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/attributesplitter.htm

Then expose the list element containing the second last word, using the AttributeCreator or AttributeManager. For example expose list element 3, list{2} and rename to a suitable attribute name.

@NatalieAtSafe I like this approach, but I'm having a little trouble getting any output results. I'm guessing I'm not entering the fields correctly, and the list elements are not showing up on the output table. Is there any way to contact you directly and get some assistance? Thanks.


I have created a sample workspace:

find-sondlast.fmw


I have created a sample workspace:

find-sondlast.fmw

That's fantastic...worked perfectly. Thanks very much for your help!


I have created a sample workspace:

find-sondlast.fmw

Thank you @erik_jan

 


I have created a sample workspace:

find-sondlast.fmw

Alternatively, the ListIndexer can be used here. e.g.

 

 


use a onliner in pythoncaller:

in input function write:

feature.setAttribute('Your_new_attribute',feature.getAttribute('attribute_with_words_i_want_the_second_last').split(' ')i-2])

Reply