Skip to main content
Question

How can i remove an element from a list

  • Jan 5, 2017 10:56 AM UTC
  • 7 replies
  • 1316 views

bradr
Contributor
Forum|alt.badge.img+9

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
  • Jan 5, 2017 11:22 AM UTC

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


bruceharold
Influencer
Forum|alt.badge.img+19
  • Influencer
  • Jan 5, 2017 2:54 PM UTC

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


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • Jan 5, 2017 2:56 PM UTC

This calls for a ListElementRemover.

Post the idea, I would suggest.


jdh
Contributor
Forum|alt.badge.img+41
  • Contributor
  • Jan 5, 2017 3:28 PM UTC

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
  • Jan 5, 2017 3:46 PM UTC

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
  • Jan 5, 2017 3:55 PM UTC

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
  • Jun 25, 2025 6:00 AM UTC

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.