Sum recursevely elements of a list

revit
excel

#1

Hello folks, I
digging a bit have found a post that helped me


thanks to @Nick_Boyts I managed to sum the element of a list by its unique parameter values.
I actually created a node that in the screenshot is In the upper side…it says “CombiningandSumfromaList”[just to shorten the graphs, basically all that in green is inside this new node]
In fact i would continue doing this sum until the list is over.
So I used the node the rest of Items and to repeat the same logic.
I would rather using Python for doing but since is it a list managing problem and I would love to learn more about it how can this be achieved here?
Those sums will be then inserted into data and write to Excel [ which I know the same can be achieved easily]
Thanks.:grinning:


#2

rvt and dyn files please


#3

Hey there,

Whenever I have to sum recursively I use this trick.


Adding values within a list and create a new list
#4

another example


#5

Thanks. Both solutions are quite smart. At the moment I am seeing how to adapt them to my needs. I guess I have to chop the list into sublist whenever elements share the same value parameter (unique items). then recompose the list inserting the new sums at the right index.


In the screenshot You can see the previous solution (A in Blue) that sum all the elements that ad index 0 have the same value.
Above the solutions you suggests me (I add a flatten node) that will attempt to sum, …still working about it and positive I can solve it.


#6

I almost there. I need to find , count the times an item shows the same value in the list already.
Basically I have list composed of 534 that is ordered by index 0, and result of 178 elements. Those unique values are only 17. I want to feed the sum with the value of the list (at index 2) corresponding to that same value at index 2.
Then I create a Dictionary with keys, which are the 17, and the values are the sums.
In the picture I guess it is the red arrow i need to feed…

thus I can sum partial sums…
[get values and == nodes where my attempts in doing it…