I keep wanting to think of trees as nested lists, but that keeps leading to confusion. For example, I have a PolyLine component that’s outputting a bunch of polygons, and by default it’s outputting them all on their own branches as pictured here:
When I try using List Item to browse these polygons, no matter what index I select every single polygon is highlighted in green on the screen. Why? If I flatten the output it and use List Item I can clearly select each Polygon individually.
If the tree is a nested list, then I understand that ((polygon)) might be not exactly the same as (polygon) (though it feels like the obvious desired behavior here is to still highlight ((polygon)) on the screen), but why does it highlight all the polygons, including the ones that are definitely not contained within ((polygon))?
Your tree is a list of lists. List item selects items at the given index in the lists you supply. I assume you have wrap (the bottom input in the List Item component) set to true. This will wrap the index value back around to the start of the list when it exceeds the list length (so if you input i=11 for a list which only has 11 items (indices # 0-10) then it will wrap back to the beginning and select the first item (index = 0).
So, when you input a tree into list item, it will select the items at that index in all branches. If you have wrap set to true and only one item in each branch, then no matter what index you enter,it will always wrap round to 0 and show you all items (as you are inputting i=0 and all branches have one item at i=0).
If you want to select only a particular branch, you should use the TreeBranch component. If you want a particular item from a particular branch, then TreeItem would be best.
List item gets an item from a branch. Before you flatten you have each polygon in its own branch. So list item 0 will the the first (and in this case only) item from each branch. When you flatten you make one branch with all the polygons (items). So you can search item at index one and get the second item in that single flat branch. If you don’t want to flatten then what you are looking for is tree branch component to list a branch.