Get Item At Index with Loop While

Hi there!

I have a list of lists and I am trying to get each one of the sub lists separately further in the graph, because I don’t want to deal with the complex lacing and levels that occur if I keep it.

So, what I want to do is to use the LoopWhile node with the List.GetItemAtIndex node. It seems like I don’t really understand how LoopWhile works because it seems to give me only the last member.

I don’t know how many sub lists my main list will have when I run the graph in real situations, so I can’t use List.GetItemAtIndex with manual index values.

Please, have a look:

Example.dyn (35.2 KB)


I’m confused… You want to separate your inputs but you’re trying to do it with a node that would return them in a list again? What’s wrong with the solution you show up top?

And even though you probably don’t want to hear it, the best solution is to figure out how to make it work with list levels and lacing.

1 Like

loop while isn’t the right node for this situation. Not sure how many final lists you’ll have so it’s hard to say what will work best. But if you play around with firstItem and lastItem nodes you can sort your lists into beginning/middle/end lists (assuming middle is the sublist that can expand)

Thank you for your help.
Indeed, LoopWhile was not a good idea, I haven’t used that node too much.
I found another way to structure my graph and things are looking good so far.

I have a same problem, can you show me that solution. The number of list is unknown.

Well, the solution could be to use nodes at different levels - I used List.Map a lot in combination with other nodes to achieve what I needed.

If you can’t figure it out on your own, my advice is to post it here on the forum. You will find plenty of people willing to help.

1 Like