# Replace By Condition not replacing values from list

**URL:** <https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916>\
**Category:** Lists-Logic\
**Created:** [July 19, 2018, 11:43am UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916 "2018-07-19T11:43:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ROY](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/roy/32/55244_2.png) [@ROY](https://forum.dynamobim.com/u/ROY)\
**Post date:** [July 19, 2018, 11:43am UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/1 "2018-07-19T11:43:25Z")

</div>

I am trying to replace values containing “Doors” with “DB” which is not working! Help please. ([[https://imgur.com/a/E6mDZWh](https://imgur.com/a/E6mDZWh)])

 ![Dynamo%20Replace%20by%20condition](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/2/82a25c86d76b7899b791621a1fd9b0843e36275e.png)

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [July 19, 2018, 11:47am UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/2 "2018-07-19T11:47:48Z")

</div>

This is basically an “if”-statement… saying "if x = doors then DB else x 🙂

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

You cannot use “less or equal” to evaluate a string that should be used for values 🙂

You might be able to use the “equal” node instead though…

---

<div class="post-metadata">

**Author:** ![ROY](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/roy/32/55244_2.png) [@ROY](https://forum.dynamobim.com/u/ROY)\
**Post date:** [July 19, 2018, 11:54am UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/3 "2018-07-19T11:54:00Z")

</div>

Hello, thanks for the input. i just checked and found its working fine with codeblock but not with my list. ☹

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/4/642fa3e1a26d6d821d7f31214a8a9c213cd04ea4.JPG)

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [July 19, 2018, 11:55am UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/4 "2018-07-19T11:55:15Z")

</div>

Have a look at what kind of object you’re dealing with:

use the “Object.Type” node and connect that to your flatten node 🙂

---

<div class="post-metadata">

**Author:** ![ROY](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/roy/32/55244_2.png) [@ROY](https://forum.dynamobim.com/u/ROY)\
**Post date:** [July 19, 2018, 12:08pm UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/5 "2018-07-19T12:08:03Z")

</div>

I am little confused here. Basically what i need to do is, i want to feed a value to a new project parameter depending on what category it is. Its working fine with single category. But when I’m combining more than one categories its not working. Kindly advice.  
Below script is for single category. New project parameter is A and DR values are fed to it.  
Now i need to feed WN for project parameter A for Windows.  
I can run this script multiple times changing its category but it will not be efficient.

 ![Capture2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/a/0a5ec15fed4dd980833fa937368ab2daf7c3ec4f.JPG)

---

<div class="post-metadata">

**Author:** ![ROY](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/roy/32/55244_2.png) [@ROY](https://forum.dynamobim.com/u/ROY)\
**Post date:** [July 19, 2018, 12:12pm UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/6 "2018-07-19T12:12:22Z")

</div>

i tried flatten node with object.type but its now working

 ![Capture3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/e/5ebe8226177eee640979889f2bd9d6bbf8891002.JPG)

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [July 19, 2018, 12:16pm UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/7 "2018-07-19T12:16:40Z")

</div>

That in itself wouldn’t work 😉 But my suspision is confirmed as to why my first suggestion does not work… You’re trying to compare “Revit.Elements.Category” elements to “strings” (called “doors”) that will not work, you could use “Object.ToString” but you might not be able to subsequently reuse the name “door”/“db” as it is now string and not an Revit.Elements.Category element…

---

<div class="post-metadata">

**Author:** ![ROY](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/roy/32/55244_2.png) [@ROY](https://forum.dynamobim.com/u/ROY)\
**Post date:** [July 19, 2018, 12:22pm UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/8 "2018-07-19T12:22:24Z")

</div>

ok so one quick question:  
when i am replacing with replaceitematindex its working fine.

 ![Capture4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/d/1de6f2d18e2eec5a905342b032a3174ada179f1f.JPG)  
And is there a way so i can create a list with “Doors” replaced by “DB”?

---

<div class="post-metadata">

**Author:** ![ROY](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/roy/32/55244_2.png) [@ROY](https://forum.dynamobim.com/u/ROY)\
**Post date:** [July 19, 2018, 12:30pm UTC](https://forum.dynamobim.com/t/replace-by-condition-not-replacing-values-from-list/23916/9 "2018-07-19T12:30:50Z")

</div>

Its working with the node string from object.  
Thank you so much!!
