Question

How can i remove an element from a list

  • 5 January 2017
  • 6 replies
  • 114 views

Badge +2

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

Userlevel 2
Badge +17

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

Badge +16

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

Userlevel 2
Badge +12

This calls for a ListElementRemover.

Post the idea, I would suggest.

Badge +22

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.
Badge +2

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!
Badge +2

This calls for a ListElementRemover.

Post the idea, I would suggest.

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

 

 

Reply