Preventing a list consisting of null values

As shown in the image below (image A) I tried three different methods to filter out null values from a list while preserving the order. The aim is to write these lists to Excel later on. The parameter I’m interested is ‘Phasing Demolished’. When some walls have a different value for Phasing Demolished the script works. Despite getting some errors.

Now the problem is when Phasing Demolished is all set to None for every wall in this project, the script returns empty lists because all values are null. I want to use these lists later on to create and transpose lists for writing to Excel. This does not work with empty lists.

Is there some way to preserve list length with a list of all null values? I was thinking on trying to filter the list with an if-statement before it takes a Parameter.Name value. But I can’t seem to get it to work. Thanks in advance.

I would go with the Python option, Method 1. The only problem is getting the phase name, which you can add to your Python code.

Instead of

else:
     output.append(i)

use

else:
     output.append(i.Name)

Thank you very much!, that solution was really easy. :grinning: I did not know you could acces element names in Python. I was thinking too difficult. It is exactly what I needed.

You have access to (almost) the entire API. There’s a lot you can do.