List Management Question

Hello there,
I have a “simple” list management question
In this example, am not sure why am not getting the expected “Letter, Letter, Letter” and “Else, Else”.
Any help would be much appreciated.
28_List_Management.gh (16.1 KB)

Flatten your LIST ITEM input?

Thanks, but I want to keep the data structure


item1.gh (10.6 KB)

1 Like

graft the member input

to give you a brief explanation, take into exam the List Item component, that is where the situation arises:

in the List input you have a Data Tree with 2 branches (your original data)
in the Index input you have a Data Tree with 6 branches (the Index output of Member Index)

take into account that the actual number/addresses written as the Paths of each Branch are just for us humand beings, not for Grasshopper :smiley: Grasshopper just pars them 1:1 whatever is the path

using the principle of Longest List, when two lists have to interact with each other and they have different lengths, the last item of the shorter list is just duplicated until each item of the longer list is covered

same thing happens for the branches: first branches of each tree are processed together, second branches of each tree are processed together (which already produce unwanted results)… and when it’s time to process the third branch of each tree, from the List input it just takes again and again the last branch, like this (color much helps):

so the actual way you are selecting items by using that data structure is the following, which makes total sense if you think at that the Grasshopper way, and the final result is perfectly fine despite being different from your expectations:

as Ftzuk suggests, that’s the best way to accomplish what you want to do, in alternative you can also opt for Unflatten, which is a one-component solution and yields the exact same result:

2 Likes

that won’t work, for the same reason explained above:

2 Likes

I changed the names in the second list.
The result is this.

1 Like

I haven’t read all of @inno 's post, but he is the resident tree master.

Anyhow, here is a solution:


28_List_Management _ vr1.gh (24.8 KB)

You can Trim Tree to reduce the data set to two branches. Or use Stack Data to get there directly:

If you want them sorted, you can skip the set and pass an in twain inputted Item Index into Sort Text to get a map.

1 Like

Alternative.

Thank you, everyone!! Much appreciated!
I have added another couple of nodes, as I am interested in having both indeces and unique values.

28_List_Management_v2.gh (14.8 KB)