# Get Item At Index with Loop While

**URL:** <https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413>\
**Category:** Lists-Logic\
**Created:** [June 20, 2019, 12:54pm UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413 "2019-06-20T12:54:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Paskalev](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Julian\_Paskalev](https://forum.dynamobim.com/u/Julian_Paskalev)\
**Post date:** [June 20, 2019, 12:54pm UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413/1 "2019-06-20T12:54:01Z")

</div>

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](https://forum.dynamobim.com/uploads/short-url/a8Jc97crbbOVWE7ht5tQGsApKQ6.dyn) (35.2 KB)

 ![Get%20item%20at%20index%20loop%20while%20CAPTURE](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b4828604e33ce68cf105896ba52afcd66ec0589.jpeg)

Regards,  
Julian

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [June 20, 2019, 3:26pm UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413/2 "2019-06-20T15:26:05Z")

</div>

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?

Edit:  
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.

---

<div class="post-metadata">

**Author:** ![jp2982](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jp2982](https://forum.dynamobim.com/u/jp2982)\
**Post date:** [June 20, 2019, 4:10pm UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413/3 "2019-06-20T16:10:32Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Julian\_Paskalev](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Julian\_Paskalev](https://forum.dynamobim.com/u/Julian_Paskalev)\
**Post date:** [June 20, 2019, 9:19pm UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413/4 "2019-06-20T21:19:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mr.Coffee](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mr.coffee/32/76008_2.png) [@Mr.Coffee](https://forum.dynamobim.com/u/Mr.Coffee)\
**Post date:** [June 21, 2019, 10:42am UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413/5 "2019-06-21T10:42:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Julian\_Paskalev](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Julian\_Paskalev](https://forum.dynamobim.com/u/Julian_Paskalev)\
**Post date:** [June 21, 2019, 1:13pm UTC](https://forum.dynamobim.com/t/get-item-at-index-with-loop-while/37413/6 "2019-06-21T13:13:40Z")

</div>

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.
