# Replace non booleans in a list

**URL:** <https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330>\
**Category:** Packages\
**Created:** [October 7, 2015, 2:36am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330 "2015-10-07T02:36:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maria\_Barahona](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Maria\_Barahona](https://forum.dynamobim.com/u/Maria_Barahona)\
**Post date:** [October 7, 2015, 2:36am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/1 "2015-10-07T02:36:21Z")

</div>

Hi,

I have been digging in the forum but can find anything around this…

I want to replace the non booleans in this list by a true value. What is the condition I’m looking for? how do I formulate it?

![replace true](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/6/6bdc21b29b67c1d84a3cc337cb8141a23273eb96.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![Maria\_Barahona](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Maria\_Barahona](https://forum.dynamobim.com/u/Maria_Barahona)\
**Post date:** [October 7, 2015, 3:49am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/2 "2015-10-07T03:49:20Z")

</div>

I’ve found a way around, using “replace items at index” as I have the list of the numbers in my mixed table. Still, if somebody could help me with the query above I’s be glad.

&nbsp;

thanks!

M

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [October 7, 2015, 4:19am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/3 "2015-10-07T04:19:07Z")

</div>

Hi Maria,

I think your looking for this.

![Untitled](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/f/f568aa35572a0e24f0a50d708c9603451b8dadc5.png)

![Untitled1](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/6/6da95dd4134ba9eab0694700e0ea408d999bd01b.png)

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Maria\_Barahona](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Maria\_Barahona](https://forum.dynamobim.com/u/Maria_Barahona)\
**Post date:** [October 27, 2015, 6:23am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/4 "2015-10-27T06:23:47Z")

</div>

Yes! thanks Kulkul.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Mata](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alejandro_mata/32/17290_2.png) [@Alejandro\_Mata](https://forum.dynamobim.com/u/Alejandro_Mata)\
**Post date:** [April 12, 2016, 2:30am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/5 "2016-04-12T02:30:01Z")

</div>

Hi guys,

I’ve been trying to convert the true values of a list by a numeric values from other list and remove the false values also. I’ve been using “Boolean Input to Variable String Output” from bakery nodes, “Combine by Pattern” from archi-lab nodes and also replacebycondition node. However I didn’t succed with any of them.

![Replace true values and remove false values](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/a/ab4714b746a6b181f224ada4a16be61fe9d47c6e.jpg)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

Just for making more clear my approach is from the first boolean list to get the following list:

[0] List

[0]2011200

[1]null

[2]null

[3]null

[4]null

[1] List

[0]null

[1]null

[2]null

[3]null

[4]null

[2] List

[0]null

[1]2971200

[2]null

[3]null

[4]null

[4] List

[0]null

[1]null

[2]1080000

[3]null

[4]3414576

[1] List

[0]null

[1]null

[2]null

[3]2971200

[4]null

Thanks for your time and help 🙂

Best regards,

Alejandro Mata

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [April 12, 2016, 4:12am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/6 "2016-04-12T04:12:06Z")

</div>

Hi Alejandro,

&nbsp;

here are two ways i found to solve your problem. I prefer design script option for obvious reasons 🙂 I really don’t know why a can’t use list.map with replacebycondition…

&nbsp;

 ![replace by condition](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/9/9000e3bb676509b070146803a868e4fce9d5446f.png)

---

<div class="post-metadata">

**Author:** ![Alejandro\_Mata](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alejandro_mata/32/17290_2.png) [@Alejandro\_Mata](https://forum.dynamobim.com/u/Alejandro_Mata)\
**Post date:** [April 12, 2016, 5:53am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/7 "2016-04-12T05:53:14Z")

</div>

Hi Mostafa,

Thanks a lot for your quickly answer and great solution. You are really good! 😉

Finally thanks to your help I managed to get the list of values that I was looking for.

 ![Design Script Solution](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/1/126f8eff61f28c11864e67ae781b7a9f02203145.jpg)

&nbsp;

&nbsp;

&nbsp;

Actually I didn’t know that you could use the programming language “Design Script” within the code block note. I thought that the only way of make your costume nodes in dynamo was by making your own python script. That’s why, I started to learn python some months ago.

What do you think that are the advantages of programming in “Design Script” vs “Python”?

&nbsp;

Have a nice day,

Best regards,

Alejandro

&nbsp;

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [April 12, 2016, 6:23am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/8 "2016-04-12T06:23:44Z")

</div>

You are most welcome.

I’m really not an expert in programing … I’m just on the process of learning python too, because I believe it is much more powerfull than design script as it allows you to interact directly with revit API.

Design script came more naturally after a year of using dynamo because it uses the same functions as nodes …

---

<div class="post-metadata">

**Author:** ![Alejandro\_Mata](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alejandro_mata/32/17290_2.png) [@Alejandro\_Mata](https://forum.dynamobim.com/u/Alejandro_Mata)\
**Post date:** [April 13, 2016, 6:51am UTC](https://forum.dynamobim.com/t/replace-non-booleans-in-a-list/2330/9 "2016-04-13T06:51:50Z")

</div>

Hi Mostafa,

Thanks for your opinion regarding the advantages of using DS vs Python.

I’m agreed with you that python can be such a powerful tool in combination with dynamo.

Basically with a good knowledge of these, you can achieve with revit whatever you want. That’s why for me is really exciting to keep learning dynamo and python everyday 🙂

Best regards,

Alejandro Mata
