Remove Nulls/List Clean?

I can’t seem to get list.clean to work. NULL values pass thru regardless if I toggle preserve indexes or not. I don’t want to use any 3rd party add-ins at all.
I have two paths in the screenshot below, List.Clean and a < compare and neither work. Everything I can find googling says this should be removing NULLs from my list.

Likely they are not null, they are strings without a value

2 Likes

I’ve spent easily an hour and a half trying to figure that out. Thank you SO much!!! I swore they’d be NULL since they’re unplaced Area Square Footage values!!!
nulls02|567x499

1 Like

Glad to be of help. The distinction here would be that null would be returned if the parameter could not be found, whereas in your case the parameter exists on the queried element but has no value, so returns a “blank”

1 Like

Great tip! Never did know how to determine “blank” over NULL! Seems pretty obvious now that it’s been mentioned haha!

In C# there is a nice method on strings IsNullOrEmpty() which covers both eventualities, and Python has if not myString: which returns true if it is blank or null, but Dynamo doesn’t have an OOTB node that combines the two but you could use DesignScript: (x==null)||(x=="")?false:true;

4 Likes

I need to get into Python, I keep resisting learning a proper language, but I know I need to anymore. That is a very handy little snippet!

The designscripting part of Dynamo is actually C#, not python :stuck_out_tongue:

(Still very handy though, i use it all the time)

A null value will tell you it’s null. A “blank” is an empty string.

1 Like

the design script part of Dynamo is not c# or python - it is Designscript - a completely different language.

2 Likes