Skip to main content
Question

How can i remove an element from a list

  • January 5, 2017
  • 7 replies
  • 1004 views

bradr
Contributor
Forum|alt.badge.img+9
  • Contributor
  • 14 replies

I have a list and with ListSearcher i found that element with id {_list_index} needs to be removed completely from the list. How can i achieve this.

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.

7 replies

takashi
Celebrity
  • 7843 replies
  • January 5, 2017

Hi @bradr, the ListElementFilter from the FME Hub might help you to keep or remove elements that match a specific condition.


bruceharold
Supporter
Forum|alt.badge.img+19
  • Supporter
  • 351 replies
  • January 5, 2017

This is why lists should be JSON structures... :-)


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • January 5, 2017

This calls for a ListElementRemover.

Post the idea, I would suggest.


jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • January 5, 2017

This calls for a ListElementRemover.

Post the idea, I would suggest.

I have exactly that custom transformer. Unfortunately I'm not allowed to post CT developed on company time, but it's a fairly straight forward PythonCaller. Get the list name, get the index, loop though the list (starting at i) replacing the attribute of list{i} with list{i+1}, remove list{-1}. The only "gotcha" is the behaviour of complex lists. Do you remove only the subcomponent, without reindexing, or do you remove all the related lists for that index, and reindex all of them.

bradr
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • 14 replies
  • January 5, 2017

Hi @bradr, the ListElementFilter from the FME Hub might help you to keep or remove elements that match a specific condition.

 

Tanks @takashi, the ListElementFilter does the job!

bradr
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • 14 replies
  • January 5, 2017

This calls for a ListElementRemover.

Post the idea, I would suggest.

done, https://knowledge.safe.com/idea/38197/listelementremover.html

 

 


aquee
Contributor
Forum|alt.badge.img+3
  • Contributor
  • 6 replies
  • June 25, 2025

Just noting that I had this same issue and a completely-vanilla solution (@2021.2.6.0) is to ListExploder the list, do some simple Testing/Filtering, then ListBuilder the elements (minus the ones you removed) back into a list.