Replace Empty List with String

Hi Everyone,

This is my first post so hopefully i’m not going to go against any etiquette.

I’ve been searching online for an answer to this query for a few days now and I can’t find the answer i’m looking for. I have a parent list which contains some empty lists, the list can be varying lengths for different designs and the empty lists can occur at any point or not be present at all dependent on the design layout. All I want to do is replace the empty lists with a simple “-” string, I’ve tried many ways but can’t seem to achieves this.

The below shows the different ways i’v tried so far, I’ve also tried lots of combinations of lacing as advised online with no joy. I think I may have to delve into a Loop.While to insert the items in separate steps in the List.Insert node or the List.ReplaceItemAtIndex node, as they are creating separate sub-lists which is not what I want.

Any suggestions would be much appreciated;

Thanks

Hey, welcome to the forums.

For dealing with nulls and empty lists, I use a node called “Null Replace” or “Remove nulls”, I believe its part of the clockwork package. I’ll check once I can get on dynamo

Thanks Joe,

Using List.ReplaceNull now works, but it’s a bit dodgy as i’d expect the Clockwork List.ReplaceEmptyLists node to do this job by itself, but it just changes empty lists to “null”, and then the List.ReplaceNull node works on that output, see below;

But it does the job so i’m happy with that.

Cheers

You don’t want longest lacing on that node. Now it’s looking for empty lists within the empty lists.
You have to keep in mind where your empty lists are located.

This is what I get when I set the same node to longest or shortest lacing. I still need to replace the null values later on the longest lacing version;