Selecting an Item from a List

Hi everyone,

I just started learning Dynamo three days ago and I need a help in selecting an item from a list.

I want to select only 0 (the highlighted items) from each list and sum them up.
What is the node that I should use to do it? I’ve been googling it but not a good answer!

thank you very much in advance

List.GetItemAtIndex with level of the list input set to @L2.

Alternaively List.Transpose > List.FirstItem > Math.Sum which will transpose the lists so “a list of all the first items in the sub lists, then a list of all the second items in the sub lists, then a list of all the third items in the sub lists…”, then get the first sub list (all the first items in the original list) then sum the values.

One last option: List.Deconstruct with the list input set to @L2 > List.Flatten > Math.Sum. This method is useful if you’re going to look for the area of the windows/doors in the room as once you’re done summarizing the values.

Thank you for the response!
So how exactly do you achieve
List.GetItemAtIndex with level of the list input set to @L2?

sorry for such a beginner question. thank you for your time.

The second solution with LIST.TRANSPOSE works completely fine but wanted to learn more! thank you once again!

Section 6.3 of the Dynamo primer, about half way down the page, covers List Levels: Lists of Lists | The Dynamo Primer

The whole of the primer is likely worth reviewing in it’s entirely since it sets a solid foundation for you.

The example of how I envisioned it working:

2 Likes

Hi Everyone,

I was trying this node called List.FilterByBoolMask. I am trying to retain the selected Revit link file (Highlighted in Yellow) & filter out my other link references. Unfortunately, after using the above node, every time it retains the other linked file in the list and kicks out my selected Revit link file. I don’t want to use getitematindex node as I am preparing the script for Dynamo player and user will not have access to modify the script.

I have even tried to use != operator instad of == to swap the result. But no luck. Any lead will be really appriciated.
Copy Elements from Linked File Trial.dyn (26.6 KB)

II think you don’t need the List.Transpose @dibyendu.b

This should do the trick.

You can’t just simply feed lists into nodes.

1 Like