# Dynamo List Compare

**URL:** <https://forum.dynamobim.com/t/dynamo-list-compare/58928>\
**Category:** Lists-Logic\
**Tags:** dynamo\
**Created:** [January 5, 2021, 9:31am UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928 "2021-01-05T09:31:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimGreatrex](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@TimGreatrex](https://forum.dynamobim.com/u/TimGreatrex)\
**Post date:** [January 5, 2021, 9:31am UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/1 "2021-01-05T09:31:11Z")

</div>

Hello Forum

Would I be able to ask for help with another list compare issue? I am stuck trying to compare two unequal lists of items. I have tried as both numbers and strings but I am not getting the output I expect. I would expect to see it true twice as there is both 2 and 4 in both lists, but it is only giving me true once in the list.

Please could anyone help? I have tested all of the other examples in the many list compare topics, but I cannot seem to get any to work.

 ![List Compare](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/62355acc4e14326f1a744b69ef81b03e709b3030.png)

Thank you for any help.  
Tim

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 5, 2021, 11:08am UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/2 "2021-01-05T11:08:53Z")

</div>

Hi Tim,

Your == node is only getting 1 true output because it is matching your items 1,2 to 4,2. So only the 2 match up this way. To Get around this i would use the node **List.AllIndicesOf** to get the indices of each individual value in your list. Also i added some nodes to recreate your true / false lists.

Like this:

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

[2021-01-05 Comparing Sublists of Unequal Lengths.dyn](https://forum.dynamobim.com/uploads/short-url/ljMWGUvVPvYMVd0ra8GyurGfgJi.dyn) (13.4 KB)

There are probably multiple (and better) ways that can achieve this result. Like setting the == node to cross-lacing, but i couldnt get the first list to only match up to the other first list.

---

<div class="post-metadata">

**Author:** ![TimGreatrex](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@TimGreatrex](https://forum.dynamobim.com/u/TimGreatrex)\
**Post date:** [January 5, 2021, 11:24am UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/3 "2021-01-05T11:24:55Z")

</div>

Hi Daan

This is fantastic, thank you very much for your solution. I will give this a try. I usually use the == with cross-lacing as you mention, then use an AnyTrue node and then FilterByBooleanMark. However I still could not get the result, but it will be the issue you mention about only comparing certain indices. I will try again.

Thank you also for your graph.  
Cheers  
Tim

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 5, 2021, 11:55am UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/4 "2021-01-05T11:55:25Z")

</div>

Exactly, maybe making it a custom node would work if you are using the == node.

---

<div class="post-metadata">

**Author:** ![TimGreatrex](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@TimGreatrex](https://forum.dynamobim.com/u/TimGreatrex)\
**Post date:** [January 5, 2021, 1:08pm UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/5 "2021-01-05T13:08:24Z")

</div>

Thanks again Daan

I have managed to replicate your solution, but using strings not numbers. For some reason numbers from the code block did not work with the List.All.Indicies.Of node giving me Empty Lists? It worked when I convered them to strings, I had to use a rounding node to remove the decimal places, so maybe this is casuing an issue?

 ![Numbers](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/8/482961c469079871dbee492d6817d30b3d5aaf72.png)  
 ![String](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/3/a3380ae2cd0f94f2fdbb3372a4b97fdf736d0587.png)

I am happy with the string data, so thank you again.  
Tim

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 5, 2021, 1:33pm UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/6 "2021-01-05T13:33:50Z")

</div>

Hi Tim,

Check with the node Object.Type if you are possibly comparing Integers to Doubles. I don’t know if this is the problem but you could check that.

---

<div class="post-metadata">

**Author:** ![TimGreatrex](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@TimGreatrex](https://forum.dynamobim.com/u/TimGreatrex)\
**Post date:** [January 5, 2021, 1:51pm UTC](https://forum.dynamobim.com/t/dynamo-list-compare/58928/7 "2021-01-05T13:51:31Z")

</div>

Great, many thanks again.  
Tim
