# Empty List to Value

**URL:** <https://forum.dynamobim.com/t/empty-list-to-value/28284>\
**Category:** Uncategorized\
**Created:** [November 10, 2018, 8:12pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284 "2018-11-10T20:12:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![AAU\_AdamPiaskowski](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AAU\_AdamPiaskowski](https://forum.dynamobim.com/u/AAU_AdamPiaskowski)\
**Post date:** [November 10, 2018, 8:12pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/1 "2018-11-10T20:12:08Z")

</div>

Hi, I’m trying to subtract window areas from wall areas and whenever there isnt a window within a wall, it returns an empty list, which doesn’t work in subtracting formula a-b = c, where a = wall area, b = window area.

I suppose a python if else statement might work here, but I don’t know how to formulate the question. If b == 0? If b== real? I also tried using List.isEmpty, and packages but nothing seemed to work 😕

I’m sure there is a very simple answer and I’m clearly doing something wrong.

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

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [November 10, 2018, 9:23pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/2 "2018-11-10T21:23:41Z")

</div>

Use a List.IsEmpty and a List.FilterByBoolean to take out all of the empty walls. The. You can do the math of the ones that contain windows, and put a “0” in the ones that don’t.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 10, 2018, 9:40pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/3 "2018-11-10T21:40:19Z")

</div>

Hey,

Just for completeness, @Andreas_Dieckmann also posted a solution to a similar sounding question…

> [@Determine if a solid has holes](https://forum.dynamobim.com/t/determine-if-a-solid-has-holes/28161/12):
>
> If we’re talking Revit elements you could actually just compare the original geometry with the actual geometry of the element:

Hopefully that’s useful,

Mark

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 10, 2018, 10:16pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/4 "2018-11-10T22:16:29Z")

</div>

One other method is to look at the number of items in the list at level 2, test if the count is equal to zero. if the test is true, return a 0, otherwise it return null.

That value at level 1 is then added to the lists at level 2 (effectively sliding a 0 or a null into the front of each sub list), and finally the list is cleaned without preserving indices (meaning null and empty lists are discarded, so the null values which are added are dropped but the added zeros are maintained).

This is a handy custom node to build and add to your library (using an input as the replacement as you may not always want a 0).

---

<div class="post-metadata">

**Author:** ![AAU\_AdamPiaskowski](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AAU\_AdamPiaskowski](https://forum.dynamobim.com/u/AAU_AdamPiaskowski)\
**Post date:** [November 11, 2018, 2:50pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/5 "2018-11-11T14:50:10Z")

</div>

Hi @Mark.Ackerley, thank you its a solid suggestion, however it won’t work in my case, as I’m taking element curve segments as my lengths. There are walls spanning over a couple of rooms, hence can’t measure wall surface areas per room.

---

<div class="post-metadata">

**Author:** ![AAU\_AdamPiaskowski](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AAU\_AdamPiaskowski](https://forum.dynamobim.com/u/AAU_AdamPiaskowski)\
**Post date:** [November 11, 2018, 2:54pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/6 "2018-11-11T14:54:10Z")

</div>

Hi @SeanP, putting a 0 in the ones that don’t is exactly what I’m trying to do. I do however, already have the lists filtered the way I need them to be. The issue is, that I either have some values, or have none. When I have none, the question is how to call this a 0. 🙂 Can you elaborate on how to put a “0” in the ones that don’t?

Thanks,

Adam

---

<div class="post-metadata">

**Author:** ![AAU\_AdamPiaskowski](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AAU\_AdamPiaskowski](https://forum.dynamobim.com/u/AAU_AdamPiaskowski)\
**Post date:** [November 11, 2018, 2:57pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/7 "2018-11-11T14:57:14Z")

</div>

Hi @jacob.small, this seems to be a good idea, but I’m having troubles implementing. Could you post an example, please?

So far I got there:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/9/49c66641da46d81e912507ed90b8199a0c11c7f7.png)

Many thanks,

Adam

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 11, 2018, 3:44pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/8 "2018-11-11T15:44:20Z")

</div>

Reading back, I missed a few steps… musta had a phone call mid post or something. Sorry bout that. I edited it and provided an example below.

 ![Add%20zero%20value%20into%20Empty%20List](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/5/b5ac2a915a74501204a04ba521d3fa1495a07578.png)

---

<div class="post-metadata">

**Author:** ![AAU\_AdamPiaskowski](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AAU\_AdamPiaskowski](https://forum.dynamobim.com/u/AAU_AdamPiaskowski)\
**Post date:** [November 11, 2018, 4:59pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/9 "2018-11-11T16:59:08Z")

</div>

@jacob.small, thank you so much this works well!

Many thanks for your time and detailed description, Appending a null value made all the difference 🙂 Thanks!

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 11, 2018, 5:54pm UTC](https://forum.dynamobim.com/t/empty-list-to-value/28284/10 "2018-11-11T17:54:00Z")

</div>

Glad I could help. 🙂
