Skip to main content
Question

How can i remove an element from a list


bradr
Contributor
Forum|alt.badge.img+8
  • Contributor

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.

6 replies

takashi
Influencer
  • 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
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 5, 2017

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


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 5, 2017

This calls for a ListElementRemover.

Post the idea, I would suggest.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • January 5, 2017
erik_jan wrote:

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+8
  • Author
  • Contributor
  • January 5, 2017
takashi wrote:

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+8
  • Author
  • Contributor
  • January 5, 2017
erik_jan wrote:

This calls for a ListElementRemover.

Post the idea, I would suggest.

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

 

 


Reply


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