Sum number in list, only if a value is present

Hi,

Its probably quite simple but I cant find it.
Challenge:

There is a tree (multiple lists, of which some lists are empty), I would like to add a number to all the numbers which are present. However when a list is empty it has to remain empty.

When I simply add 4 -> also the ‘empty’ list is ‘filled’ with 4.
Besides its important that the 3 lists/branch remain the same. (this is why clean tree, before adding 4 won’t help)

any suggestions?

Thank you in advance,

2020-05-01 Add values only if value is present.gh (6.4 KB)

are there empty values in branches with numbers as well? If not you can split tree by empty branches. If so you could do something similar with text length (empties are 0)

1 Like

Hi, thanks,

uhm I am afraid I dont fully understand. What I would like to have in the end:
1 tree.
(in this case the first list has to remain empty, and list 2 and 3 the values have to be added with 4)

Thanks again. :slight_smile:

:rofl:

Are there any null values in the branches that contain valid data?


2020-05-01 Add values only if value is present_re.gh (9.9 KB)

Hi,

there are only 0 values possible (not null).

thans

Thank you again :slight_smile:

Thanks :slight_smile:

Even simpler:


Add values only if value is present_2020May02a.gh (11.6 KB)

ahh nice! thx! :+1: :+1: