List.ReplaceEmptyLists Not working

I am wanting to replace an empty list with ‘0’ and I found this thread →

but the ReplaceEmptyList node shows null.

My final list shows the empties being '0’s so maybe it doesn’t matter, but my final list also shows my complete list in both instances instead of showing the individual numbers. I probably didn’t explain that very well, here is a screenshot.

Thanks

Try this node from the Synthesize package.

1 Like

Thanks for the suggestion, that worked perfectly!

1 Like

That’s actually a bad example in the post you linked. The only reason it works there is because there was only one non-empty list. The issue here is that you’re pre-filtering the empty lists. So your If statement doesn’t really align anywhere now.

You have four test conditions (four sublists) so you want four values for true and four values for false. Then you need to align those inputs via list levels.

2 Likes

I did just test if there’s an empty list in the sub list with values and it does not work sadly.

1 Like

Yeah, I wouldn’t expect it to work like that. It would have to be recursive to find an empty at any level and I don’t think that’s ever going to be what someone is looking for. Would be an odd scenario where structure is irrelevant.

My original comment was at the example given in the linked post. Filtering the empties and using List.Map only “worked” because there was only one existing value to return.

1 Like

Gotcha!

I like your OOTB solution more than mine, especially for folks trying to stay away from packages.

1 Like

Thanks for the help!