Empty List handling


#1

Hello, I have a list that is sometimes empty and sometimes not that i want to populate into a sum equation. if its empty, I want the value to be zero, so that it can actually calculate the sum. Right now since it is empty, the sum equation is failing I tried to build in an empty list handler but its not working. What am i doing wrong?
Thanks!


#2

Clockwork has a node called List.ReplaceEmptyLists that should work


#3

Thank you for the idea. However, its not working…


#4

Try this in a code block:

List.Count(a)>0?
a:
0

#5

@JacobSmall
That doesnt work either. So how does one handle empty lists if they always infect anything downstream of them?


#6

Can you share your entire graph, and provide some background on what you’re doing with the overall graph? You need to stop the issue earlier in the process, at the point when the empty list first shows up as once it happens you’ll be fighting it in every node thereafter.


#7

How about this?


(Custom Node is from Clockwork)


#8

@Andreas_Dieckmann
I was skeptical that that node would work, since you were not feeding any empty lists directly into it like I need to, but it turns out it works! MUCH appreciated!