# Get item at index + Empty List

**URL:** <https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730>\
**Category:** Uncategorized\
**Created:** [August 10, 2022, 12:00pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730 "2022-08-10T12:00:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [August 10, 2022, 12:00pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/1 "2022-08-10T12:00:20Z")

</div>

Hello  
I would like to know why I get null when the first index is “Empty List”?  
Thanks.

 ![Dynamop](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7fa02980012a207fe7e6e463c5344a723cd4ae70.png)

---

<div class="post-metadata">

**Author:** ![Meychik](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@Meychik](https://forum.dynamobim.com/u/Meychik)\
**Post date:** [August 10, 2022, 1:16pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/2 "2022-08-10T13:16:17Z")

</div>

Hi @outmanechamekh

here you try to pass empty lists to the node that accepts only integers according to the node description. You need to get rid of the empty lists and after to flatten.

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [August 10, 2022, 1:38pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/3 "2022-08-10T13:38:18Z")

</div>

Thanks for your answer, but when the first item is not “epmty list” it works, even though I have other items that are “empty list”.

---

<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:** [August 10, 2022, 1:51pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/4 "2022-08-10T13:51:52Z")

</div>

What version of Dynamo are you using? I thought I remembered this being fixed but I may be mistaken. It’s an issue that I would _guess_ stems from the node not being able to determine the appropriate list structure to use or possibly an issue with rank reduction with the first item being an Empty List (or null), but either way is a known issue. The easiest way to work around it, as well as avoid potential errors, is to filter all Empty Lists first.

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [August 10, 2022, 1:57pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/5 "2022-08-10T13:57:34Z")

</div>

Dynamo core 2.1.0.7500  
Dynamo revit 2.1.0.7733

---

<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:** [August 10, 2022, 2:05pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/6 "2022-08-10T14:05:21Z")

</div>

What does your error say? I’m in 2.0.3 and it works fine.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/f/0f50e27d99cb5857dd306497ca159fcd1aded8f3.png)

---

<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:** [August 10, 2022, 2:11pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/9 "2022-08-10T14:11:44Z")

</div>

Make sure you’re using the core node and not a similar one from a custom package.

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [August 10, 2022, 2:15pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/10 "2022-08-10T14:15:04Z")

</div>

Warning:List.GetItemAtIndex expects the argument type(s) (var…, int), but was called with (Revit.Elements.Element, int).

Yes , i use the core node

---

<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:** [August 10, 2022, 2:18pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/11 "2022-08-10T14:18:25Z")

</div>

Odd. You can try forcing the `index` to use @L2 but honestly you’re still better off filtering the Empty Lists.

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [August 10, 2022, 2:20pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/12 "2022-08-10T14:20:52Z")

</div>

![dynamo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/b/0b978de86e35c260c247b54b8c5d4c8f49800aff.png)

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [August 10, 2022, 2:27pm UTC](https://forum.dynamobim.com/t/get-item-at-index-empty-list/79730/13 "2022-08-10T14:27:37Z")

</div>

I filtered the lists and it worked.  
Thanks
