List.Clean not working even with "preserveIndices" set to false



The node is working as intended. It is not supposed to clean empty strings ( "" ), which is the last input of your list.

Use this instead :


So my issue was I was confusing “empty list” with “empty string”?


Or you can use List.Clean node in Orchid package.


Yes. Empty lists appear in the preview of the nodes as… well "Empty List" (see Alban’s post). You can still use my method to filter the empty strings if you don’t want them (using OotB nodes), or use Alban’s method (Orchid package) :slight_smile:


The OOTB node do remove “empty list”, but not “empty strings”. That was one of the reasons why I implemented a “searchFor” so the user could define what should be “cleaned”. The comparative node “Replace” is built by the same method, just replacing what is searched for.
Both my nodes are built recursive meaning they can take any nD list, the OOTB node cant handles this.

However, @Alban_de_Chasteigner made me aware that input as 1..3 cant be cleaned, in that case, you need to clean 1,2,3 as single elements, not as a list. And no matter how you want to clean, the last (empty) list will be returned!? I will try to see if I can fix that, so it will return void somehow.


That’s great. Out of curiosity, does the clean use the order of the searchFor? As in, if you were to put the {} before the 1,2,3 in the searchFor input, would it return an empty list at index 1 after cleaning the 1…3 in the list input.


It does use the order since it will look through the items in the searchFor list in the given order. However, it will always end up with the return value type. This is a "list" at the moment. When nothing is returned will this be an empty list.

I have now internally tested to change this into an object as the return value, this means that I can end up returning null as the minimal object. It is not possible to return void, when it also must be able to return any other kind of object (e.g. a list).

Next time I update the package will it then be able to do this.

Since this is a kind of fictitious example, this will be silent updated whenever I release an update.