Using IF to error trap empty list

I’m pulling data in from an Excel sheet making some alterations then pushing it back out again. However there is the possiblity that the data the script is looking for hasn’t previously been created in wihich case I want to insert a default value.

To do this I’ve tried to use an IF statement to detect if there is an empty list but for some reason regardless of the check, if a value being inputted into my if statement is an empty list it returns an empty list even if the statement is true…

Can anyone tell me why this doesn’t work or maybe point me in the direction of an alternative solution?

2017-10-18_18-49-27

https://github.com/DynamoDS/Dynamo/issues/6258

1 Like

hello keith,
just replace {}; in code block to something else, you may use double quotation “”; instead.

I need it to be able to accept an empty list so using “” won’t cut it I’m afraid.

I’d really like to know why having an empty list input stops this working…

edit just seen Andreas’ post so reading through this now…

Andreas, your solution works perfectly.

Many thanks.

K.