# How to create a Boolean Mask against two uneven lists?

**URL:** <https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507>\
**Category:** Lists-Logic\
**Created:** [June 5, 2018, 2:50am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507 "2018-06-05T02:50:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![r.lietz](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@r.lietz](https://forum.dynamobim.com/u/r.lietz)\
**Post date:** [June 5, 2018, 2:50am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/1 "2018-06-05T02:50:23Z")

</div>

This question is an extension to a question posed by @eddymejia08 [List.ContainsItem doesn’t check full list](https://forum.dynamobim.com/t/list-containsitem-doesnt-check-full-list/17202)  
What I’d like to achieve is a True/False match against the longest list by a shorter list. See image below, one list contains the numbers 1 to 45 the other contains the odd numbers 1 to 29. I can change the lacing to cross product which will identify a match in the correct sequence, but how do I create a Boolean mask against the longer list (i.e. 45 true or false) to use in a “List.FilterByBoolMask” to create a true false match against the longer list ?

 ![BOOLEAN%20MASK](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/3/a33e2ff328f39a755ed605b9a1ebc9c5465a2f2f.png)

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [June 5, 2018, 2:57am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/2 "2018-06-05T02:57:01Z")

</div>

@r.lietz are you after that?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/0/10209032876a2117524887ff643d019f25d22f7b.png)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [June 5, 2018, 3:11am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/3 "2018-06-05T03:11:53Z")

</div>

@r.lietz Something like this?

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

---

<div class="post-metadata">

**Author:** ![r.lietz](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@r.lietz](https://forum.dynamobim.com/u/r.lietz)\
**Post date:** [June 5, 2018, 3:43am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/4 "2018-06-05T03:43:57Z")

</div>

Brillant, thanks to both Vikram and Salvatore, the solutions have come quicker than a speeding ticket.

But perhaps my illustration was a little too regular for Salvatore’s solution, as when I tried it against real numbers that I have, it doesn’t quite work. And for Vikram’s, I appreciate your work, but this can be simplified further with the use of the following nodes.

 ![BOOLEAN%20MASK_02](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/9/b9b5670c7c3f56e9c2fa6a327fabaa98098c2553.png)

![BOOLEAN%20MASK_03](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/4/d4e133fbf38a16ba2157a3e7bc652e2009aa9671.png)

What I’m looking for is a true or false match against the 45 listed numbers coming from the list of 15 numbers.

---

<div class="post-metadata">

**Author:** ![r.lietz](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@r.lietz](https://forum.dynamobim.com/u/r.lietz)\
**Post date:** [June 5, 2018, 5:56am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/5 "2018-06-05T05:56:15Z")

</div>

To explain further, it seems the Point.x value is handled differently than Numbers, and as a consequence the List.Contains does not work when applied to Point.x values. The List.Transpose works but not the List.AnyTrue in this case.

 ![BOOLEAN%20MASK_04](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/2/127a3be5bf35a0b52849d8a9015e1881c2115075.png)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [June 8, 2018, 5:37pm UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/7 "2018-06-08T17:37:39Z")

</div>

> [@r.lietz](#):
>
> it seems the Point.x value is handled differently than Numbers

It’s a rounding issue. Limit the number of decimal spaces

> [@r.lietz](#):
>
> but this can be simplified further

Not if your intent is to obtain a bool mask 😑  
Ignore the last three nodes. My example there was only extended to demonstrate the working of the mask.

---

<div class="post-metadata">

**Author:** ![r.lietz](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@r.lietz](https://forum.dynamobim.com/u/r.lietz)\
**Post date:** [June 15, 2018, 3:31am UTC](https://forum.dynamobim.com/t/how-to-create-a-boolean-mask-against-two-uneven-lists/22507/8 "2018-06-15T03:31:49Z")

</div>

Well, if you end up with a speeding ticket, you generally have to cough up at some stage.

And after reviewing the evidence, I was only a little over the limit your Honour, it seems I forgot to properly lace up my boots. So the important lesson is that, when dealing with uneven lists, you need to pay attention and set your lacing to “Cross Product” on, in this case, on both “Lists.Contains”.

Apologies to Vikram, he is right if you want a boolean mask, his solution is correct and rather neat, but I’d be careful about applying any rounding of decimal points.

And Nick Boyts does a very good job, explaining it in the original post, sometimes you can’t see the wood for the trees.

 ![MATCHING_UNEVEN_LISTS](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/1/a1f6f0bdf743d31ada8b6e0849f54e34c4f76f7d.png)
