Problems with empty lists

Is anyone else having problems with Empty Lists?

I often create graphs with complex logic, which sometimes turn out to be having nested lists, and these list might also contain some “Empty List” results. I suppose this shouldn’t be a problem, since the program is supposed to manage data, and a data with empty value should be a pretty usual thing. In some cases the Empty Lists do not cause problems, but in other cases, they do.

My experience is, that if I have a list, or a list of lists (or a list of list of lists, etc.), if the first element is “empty”, or “null”, then the graph breaks from that point.

If I have “null” at any other point of the data structure, for example the second element of the first list, or the 23rd element of the 7th list of the 4th list, no problem occurs. The only problem is, if the starting value of the whole data structure is an “Empty value”. If it’s empty, I get error messages like “Dereferencing a non-pointer.”, or something like that.

It is inevitable to have data structures, which have empty values, and it might occur that the very first element is empty. It is not managable that I have to keep in mind that the first element can not be empty.

Isn’t anyone else running into this problem? How do you deal with this? Is this not a bug to be fixed?

Thanks a lot!

I already run into these 2 years ago and reported the problem:

but I think this is still present!


If a “null” value occurs at any point, it causes no problem.


If the very fist element of the data structure is “null”, the graph breaks.

It’s a known bug in Dynamo. You’ll need to get your hands dirty and manage your data - keep your data structures clean of null objects or empty lists. There’s a range of OOTB nodes which will enable you to achieve this consistently and reliably (FilterByBoolMask, etc, etc) without damaging say, lacing alignments.

3 Likes

It’s good to know that I’m not the only one aware of this!

I’m usually able to find some workaround, but in some cases, for example if I have 2 data structures paralell to each other, you can’t just filter out some empty lists from one of them, because in the parallel one the indices will get messed up.

I know you always can find some workarounds, but because of this, the logic sometimes gets extremely complicated, only to get around the empty lists.

I hope this will get fixed soon!

Anyways, thanks for the support and infos!

Hi,

If you want to keep the synchronization between two parallel lists, you have to filter both of them using the same mask (list.IsEmpty in your case).

1 Like

Usually this could work, but not in cases where one of the list has an empty value, but the same index in the other list is not emptly. I can’t filter it out because I’ll start losing data.

Only solution I could come up with in these cases was to detect which is the first non-empty index, and shift the indices in both list with this amount to make sure that the first value is not empty.

I know that @mix have had a lot of issues with this and might have an idea for a solution :slight_smile:

Hey,

A slightly generic response I’m afraid, but a filter by boolean mask can be applied to multiple lists using the same booleans… Similarly remove items at indices, if you see what I’m saying… It does get pretty tricky so all suggestions welcome :smiley:

Hope that helps,

Mark

1 Like

@Mark.Ackerley
smart ways to keep in mind when doing excel trickery :sweat_smile:

1 Like

Yeah I have had a lot of trouble with this too. usually it takes some trial and error, but my method that generally works is this: IsEmpty is a useful node, because a lot of the other ones seem to corrupt down stream nodes. Use this do identify where you empty lists are. Then, replace your empty lists with a string or a number or something to hold as a place holder. I use the old danEDU nodes to replace at index (works inside lists of lists and is brilliant) I also have another custom replace item at index node that works in certain cases too. use a clean node as soon as you get through this process as it seems to help. Then use dynamo player when running the script whenever possible or close dynamo (and possible revit) in between runs of the script as once you get empty lists in the script it seems to be able to mess things up at times. I will post a screen shot of one of my work arounds later if I have time.
hope this helps.

Edit: Ok here are some examples please see pictures


1 Like

Any chance there is a compatible node in @erfajo’s Orchid package?

I didnt see one. I have a lot of scripts dependent on his old package that I trust, so I never updated to Orchid. danEDU said he is not supporting the old package any more but I dont care. what works, works. you know? I will only upgrade if he makes a replacement for that node. Its one of the most important nodes I have.

@erfajo coded all his nodes from DanEDU up in Orchid :slight_smile:

It appears that if he did that he renamed them too, transition is not an easy upgrade to Orchid. If you have pre-existing scripts dependent on danEDU

It og course require a little work, but, you can have both installed at the same time, so starting to use orchid onwards on new graphs could be a way to go :slight_smile:

I cant verify that right now, but I seem to remember having to uninstall the old package or else I would have done that. :confused:

Sounds odd, I have both installed :slight_smile:

Ok ill have to try it again then. :slight_smile:

Can encourage you to :slight_smile: there are heaps of new fantastic nodes :slight_smile:

1 Like

Well I would hope there would be from my favorite programmer :slight_smile:

1 Like