# How to retrieve an entire sublist if it any item in the sublist contains an item

**URL:** <https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515>\
**Category:** Uncategorized\
**Created:** [February 28, 2018, 5:07pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515 "2018-02-28T17:07:50Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [February 28, 2018, 5:07pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/1 "2018-02-28T17:07:50Z")

</div>

hello,

How do I retrieve an entire sublist if it any item in the sublist contains an item? I want the entire sublist filtered out if the bool mask contains true in any of the sublist line items. Thanks!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/5/850259ea8c8241ac1a4ff26d039620e20e16c8b7.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:** [February 28, 2018, 5:45pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/2 "2018-02-28T17:45:55Z")

</div>

You want List.ContainsItem in this case. It will check an entire list (or sublist) for an item.

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

---

<div class="post-metadata">

**Author:** ![slepagetrudeau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/slepagetrudeau/32/29983_2.png) [@slepagetrudeau](https://forum.dynamobim.com/u/slepagetrudeau)\
**Post date:** [February 28, 2018, 5:46pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/3 "2018-02-28T17:46:40Z")

</div>

feed your bool list through a LIST.ANYTRUE node or LIST. ALL FALSE @lvl2, can’t rememeber the package. then pick the sublist by index of true from the returned list.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [February 28, 2018, 5:54pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/4 "2018-02-28T17:54:39Z")

</div>

Wait, that messes up my list structure and retriving all indices of true doenst work. What am I doing wrong?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/2/429abfeb39d7edbfa04c36b44d5357c3a5cf7203.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:** [February 28, 2018, 5:56pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/5 "2018-02-28T17:56:47Z")

</div>

Does the object your looking for equal “Warning” exactly? Can you show one of the warning objects in the list you’re filtering through?

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [February 28, 2018, 5:57pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/6 "2018-02-28T17:57:08Z")

</div>

no

---

<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:** [February 28, 2018, 5:57pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/7 "2018-02-28T17:57:28Z")

</div>

You have to look for the exact item.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [February 28, 2018, 5:58pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/8 "2018-02-28T17:58:36Z")

</div>

Well I do want “Warning”, but I want it as any word in any line in any index of any sublist. It may not be alone in the string

---

<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:** [February 28, 2018, 5:59pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/9 "2018-02-28T17:59:48Z")

</div>

Then you’ll have to use the method @slepagetrudeau proposed. Find any item that contains warning, then use either of those nodes mentioned, or List.ContainsItem, to find sublists that contain True.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/f/df94a62ee09ca4e8595b8de3642592b335c23b65.png)

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [February 28, 2018, 6:01pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/10 "2018-02-28T18:01:49Z")

</div>

Ok yeah that works better

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [March 1, 2018, 7:19pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/11 "2018-03-01T19:19:08Z")

</div>

just a quick question on this, why do I have to set the list.allfalse @ lvl2? I thought that if you didnt run a node at levels, it defaulted to level 2. So why change it?  
Thanks

---

<div class="post-metadata">

**Author:** ![slepagetrudeau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/slepagetrudeau/32/29983_2.png) [@slepagetrudeau](https://forum.dynamobim.com/u/slepagetrudeau)\
**Post date:** [March 1, 2018, 7:22pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/12 "2018-03-01T19:22:44Z")

</div>

Oh, it might. I’am a control freak.

No other reason than to be clear. As long as it works I don’t bother it.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [March 1, 2018, 7:23pm UTC](https://forum.dynamobim.com/t/how-to-retrieve-an-entire-sublist-if-it-any-item-in-the-sublist-contains-an-item/19515/13 "2018-03-01T19:23:30Z")

</div>

well, i still dont understand levels. thats why I asked. I could very easily be wrong…
