# FilterByBoolMask culling empty lists

**URL:** <https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017>\
**Category:** Packages\
**Created:** [February 3, 2015, 7:47pm UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017 "2015-02-03T19:47:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Wintour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paul_wintour/32/9381_2.png) [@Paul\_Wintour](https://forum.dynamobim.com/u/Paul_Wintour)\
**Post date:** [February 3, 2015, 7:47pm UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/1 "2015-02-03T19:47:06Z")

</div>

Hi

When using the ‘List.FilterByBoolMask’ node in some instances it is culling the empty list and in other instances it isn’t. It is also renumbering the index of the list. I need it to maintain the list structure. How can I do this?

&nbsp;

![List Map 1](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/5/5cedc3c271caf3c4e1900e605a6daded5947a795.jpg)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

![List Map 2](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/f/fec506cfb35d0024b06a24d4c1f8e0eba2092558.jpg)

&nbsp;

---

<div class="post-metadata">

**Author:** ![Paul\_Wintour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paul_wintour/32/9381_2.png) [@Paul\_Wintour](https://forum.dynamobim.com/u/Paul_Wintour)\
**Post date:** [February 3, 2015, 7:51pm UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/2 "2015-02-03T19:51:10Z")

</div>

![List Map 1](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/5/5cedc3c271caf3c4e1900e605a6daded5947a795.jpg)

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [February 3, 2015, 11:35pm UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/3 "2015-02-03T23:35:16Z")

</div>

It’s hard to say what is actually happening here since you’re not showing the list that is being filtered. My best guess is that this is another case where using List.Combine makes more sense than using List.Map …

---

<div class="post-metadata">

**Author:** ![Paul\_Wintour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paul_wintour/32/9381_2.png) [@Paul\_Wintour](https://forum.dynamobim.com/u/Paul_Wintour)\
**Post date:** [February 4, 2015, 12:02am UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/4 "2015-02-04T00:02:36Z")

</div>

Hi Andreas

I don’t understand your comment. The list that is being filtered is correct. What I need is this: If it is false, return null. If it is true, replace the value of the correct index. It is kinda working except it is culling the null values and changing the data tree.

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [February 4, 2015, 12:50am UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/5 "2015-02-04T00:50:43Z")

</div>

My comment was referring to the fact that in your screenshot we don’t see the structure of the list that is being filtered. It’s hard to give you any meaningful feedback that way.

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [February 4, 2015, 12:50am UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/6 "2015-02-04T00:50:59Z")

</div>

Hi Paul,

I don’t think the “List.FilterByBoolMask” will help you in your case. Have you tried the If node?

![2015-02-04_141227](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/b/b51280a5af5fb21736f44b0e11d9df3c0110f5c4.jpg)

The correct use of “List.FilterByBoolMask” is to compare two equal lists, one of which containing only Boolean values. It won’t work for mismatched lists.

---

<div class="post-metadata">

**Author:** ![Mark\_Thorley](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mark\_Thorley](https://forum.dynamobim.com/u/Mark_Thorley)\
**Post date:** [February 4, 2015, 5:11am UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/7 "2015-02-04T05:11:42Z")

</div>

Paul, see the previous discussion. If you replace your empty lists with a value of say ‘N/A’ then run the filter you may have more of a success.

&nbsp;

[http://dynamobim.com/forums/topic/putting-a-value-to-empty-lists/](http://dynamobim.com/forums/topic/putting-a-value-to-empty-lists/)

---

<div class="post-metadata">

**Author:** ![Mark\_Thorley](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mark\_Thorley](https://forum.dynamobim.com/u/Mark_Thorley)\
**Post date:** [February 4, 2015, 5:18am UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/8 "2015-02-04T05:18:15Z")

</div>

Or this one

[http://dynamobim.com/forums/topic/if-equal-return-index-error/](http://dynamobim.com/forums/topic/if-equal-return-index-error/)

---

<div class="post-metadata">

**Author:** ![Paul\_Wintour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paul_wintour/32/9381_2.png) [@Paul\_Wintour](https://forum.dynamobim.com/u/Paul_Wintour)\
**Post date:** [February 4, 2015, 6:39pm UTC](https://forum.dynamobim.com/t/filterbyboolmask-culling-empty-lists/1017/9 "2015-02-04T18:39:05Z")

</div>

Thanks for the responses. In the end I used the ‘List.GetItemAtIndex’ as suggested by Mark. Still not sure why List.FilterByBoolMask is renumbering paths in my original script but this workaround is working so all good.

&nbsp;

![Filter By Bool](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/e/e922bbd45d0f9112936e743a8d96a025dacffe01.jpg)
