Plus value next in List

Hi everyone.
I have problem about list.
I have a list
[0] = 0
[1] = 1219 + 0
[2] = 2438 + 1219
[3] = 3657 + 2438
How to do it to
[0] = 0
[1] = 1219
[2] = 3657
[3] = 6095.
please help me. Thanks.


Thank you so much.
You can see picture below. How to do?

Is something as follows how you would have expected it to work?


Though here is a out of the box node option.

List.RestOfItems - Removes first item in list
List.FirstItem - Gets first item in list

1 Like

List.AddItemToFront to add a 0 before the list, then a + node. You’ll be adding 0 to index 1, index 1 to index 2, index 2 to index 3, index n-1 to index n. Make sure lacing is set to shortest on your + node.


Thanks everyone, but I want to return a list as below:
return result:
[1]=500 ([0]+[1]–>0 + 500)
[2]=1700 ([1]+[2]–>500 + 1200)
[3]=2500 ([2]+[3]–>1700 + 800)
[4]=3100 ([3]+[4]–>2500 + 600).

Did you try the List.AddItemToFront method? The X input on the plus node is your original list, the result of the add item to front node is your Y input.

You can see picture as below. Value [2]=2133 not good, ===> [2]=2438+914=3352 good. Please help me.

Try this:

what is red box?

The number 0

Not good.

Ah! I didn’t understand your issue. You want mass addition, that is the sum of all items leading up to that point. So:

There is a node called ‘MassAddition’ in the lunchbox package which will do the trick.

You can also use a List.DropItems node to drop a range of items from -(List.Count(lst)-1) to 0 items from the list and sum those. It’s a fairly simple design script statement - I’ll write it up in the morning and post back of the lunchbox option doesn’t work for you.


Thanks @jacob.small. Good job.
I used ‘MassAddition’ in the lunchbox package.

1 Like

Sorry i thought you wanted to add the current value to previous value in a list. To get the sum total as you go along a list would be done as follows:

1 Like

Thank you so much.