# If and Lists of different lengths

**URL:** <https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669>\
**Category:** Packages\
**Created:** [April 7, 2016, 10:51am UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669 "2016-04-07T10:51:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Clementson](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Matt\_Clementson](https://forum.dynamobim.com/u/Matt_Clementson)\
**Post date:** [April 7, 2016, 10:51am UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669/1 "2016-04-07T10:51:40Z")

</div>

Can someone confirm if (no pun intended) this is expected behaviour. It’s a simple logic test to select between two different lists of different lengths, however, the returned list is always trimmed to the length of the shortest list which is not what I would expect. These two images should show what I mean.

 ![Lsits2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/f/f8a76d952ea20a3b9cb7984ae3c655ee5d40a8fe.jpg)

---

<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:** [April 7, 2016, 11:10am UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669/2 "2016-04-07T11:10:39Z")

</div>

Use the ScopeIf node. From what I’ve heard, ScopeIf seems to work more like a standard If statement. ScopeIf is usually what you want. I haven’t really found a proper use for If yet.

---

<div class="post-metadata">

**Author:** ![Matt\_Clementson](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Matt\_Clementson](https://forum.dynamobim.com/u/Matt_Clementson)\
**Post date:** [April 7, 2016, 11:32am UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669/3 "2016-04-07T11:32:23Z")

</div>

Unfortunately, ScopeIf throws a cyclical dependency error - not sure why though.

 ![Lists3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/6/6591d7caffe2eb762dfe81f9611648518bffefb1.jpg)

---

<div class="post-metadata">

**Author:** ![Jeff\_Shaver](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@Jeff\_Shaver](https://forum.dynamobim.com/u/Jeff_Shaver)\
**Post date:** [April 7, 2016, 12:20pm UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669/4 "2016-04-07T12:20:35Z")

</div>

```
In that example you could just run another list.create directly after the first one then flatten after your if statement.
```

---

<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:** [April 7, 2016, 12:28pm UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669/5 "2016-04-07T12:28:47Z")

</div>

ScopeIf seems to throws up an error if there is more than one (ScopeIf) node

---

<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:** [April 8, 2016, 2:14am UTC](https://forum.dynamobim.com/t/if-and-lists-of-different-lengths/3669/6 "2016-04-08T02:14:17Z")

</div>

We had a long discussion about this back when version 0,81 was released. One possible solution is to use imperative code. I believe that the Zebra package has a node that uses a similar solution.  
[http://dynamobim.org/forums/topic/0-8-1-release-candidate-available/#post-16581](http://dynamobim.org/forums/topic/0-8-1-release-candidate-available/#post-16581)

&nbsp;
