Skip to main content
Solved

I am trying to find a way to essentially extract characters in a list until the end of that list


chrbalm
Contributor
Forum|alt.badge.img+8

I want to find a way to pull out the first 13 characters in each list element until the list ends (identified by ItemsInList attribute). I currently have this:

@Left(@Value(_list_UAIDs{@Value(ItemsInList)}),13)

However this only returns the last entry. I want it to return every instance within the list.

I wasn't sure if it was that simple of if I could create a looper to resolve this?

Best answer by oscard

Would it be possible for your data to explode the list with the ListExploder, use the function you have posted and then build the list again?

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

4 replies

oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • Best Answer
  • January 31, 2020

Would it be possible for your data to explode the list with the ListExploder, use the function you have posted and then build the list again?


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • January 31, 2020

If not wanting to explode the list, I'd probably use python to do this.


chrbalm
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • January 31, 2020

Exploding for this purpose has done the trick, but I still would find it interesting if it's possible to extract this data in a single cell, maybe separated by a comma?


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • January 31, 2020
cbalmbra1 wrote:

Exploding for this purpose has done the trick, but I still would find it interesting if it's possible to extract this data in a single cell, maybe separated by a comma?

If you wanted to use a pythoncaller, this would create a new comma separated value in an attribute called first_13 where _list{}.value is the name of your list

import fme
import fmeobjects

def firstthirteen(feature):

    mylist = [value[:13for value in feature.getAttribute('_list{}.value')]  
    feature.setAttribute("first_13",','.join(mylist))

 


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