Skip to main content
Best Answer

Truncating a list

  • May 9, 2022
  • 4 replies
  • 21 views

deanhowell
Influencer
Forum|alt.badge.img+24

Is there a way to truncate a list?

 

For example if I have a list of 30 items but only want the first 10 to be kept. I know

I could manually create the list with an attribute creator using _list{0}, _list{1}, _list{2}, etc but just wanted to see if there is a transform or more automated way to do something like this.

 

Regards

 

Dean

Best answer by geomancer

Have you looked at ListSlicer from FME Hub?

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.

4 replies

geomancer
Evangelist
Forum|alt.badge.img+60
  • Evangelist
  • Best Answer
  • May 9, 2022

Have you looked at ListSlicer from FME Hub?


connecter
Contributor
Forum|alt.badge.img+10
  • Contributor
  • May 9, 2022

Hi @deanhowell​ , here is another transformer to try: ListSampler -> First N Elements


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • May 10, 2022

Have you looked at ListSlicer from FME Hub?

Thanks @geomancer​ the ListSlicer worked perfectly.


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • May 10, 2022

Hi @deanhowell​ , here is another transformer to try: ListSampler -> First N Elements

Thanks @connecter​ I will look into the ListSampler as that looks good also.