Remove nulls from list

I feel this should be easy but for some reason I’m just not getting what I need.

I have a list from excel that contains nulls for worksheets that don’t exist in the selected file. How can I remove the nulls from the top level of this list just to leave me with the elements with sub lists?

In the example below I want to Dynamo to keep lists 0 and 4.

You could simply use List.GetItemAtIndex for this. See on this page:
http://dynamoprimer.com/en/07_Code-Block/7-3_shorthand.html

Also, this.

3 Likes

edit

lesson here - don’t read posts like this on your phone!

Okay,

@Yna_Db, that doesn’t work for me as the number of items in the list and those to be included vary from project to project.

@john_pierson - that works, thanks, I had tried this previously but due to the list complexity I had misunderstood the results I’d got. I need to do a little bit more in terms of flattening etc but it gets me to where I need to be I think. Will confirm later once I have tested things a bit further.

Thank you both for your suggestions.

1 Like