# How to replace all null with multiple values

**URL:** <https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837>\
**Category:** Uncategorized\
**Created:** [June 14, 2018, 9:12pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837 "2018-06-14T21:12:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [June 14, 2018, 9:12pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/1 "2018-06-14T21:12:40Z")

</div>

hello, I have two lists that have corresponding null values that I need to splice together, but how do I replace multiple null values with the multiple (different values) for each null value. I want to have one full list, with only the values of these two lists. but need to retain their relative index positions no matter what. meaning if the nulls are in different indicies the next time i run it. Thanks!

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

---

<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:** [June 15, 2018, 4:32am UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/3 "2018-06-15T04:32:15Z")

</div>

Maybe something along the lines of this?

 ![DynamoSandbox_2018-06-15_12-30-20](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/e/be3c1b07a3e59d354726bfc107f678dbdc67c44d.png)

---

<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:** [June 15, 2018, 5:19am UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/4 "2018-06-15T05:19:42Z")

</div>

@mix See if this serves your purpose…

 ![replaceNull](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/4/e43bfe6c1996086c702f4f4d2f84bb1dcd7f0b45.png)[replaceNull.dyn](https://forum.dynamobim.com/uploads/short-url/uR2HD2000z6fOVmSLm7ZGNQUBsr.dyn) (10.9 KB)

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [June 15, 2018, 12:38pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/5 "2018-06-15T12:38:26Z")

</div>

Hi erfajo,

I havent upgraded to orchid yet because I have so many scripts that require your DANedu nodes that it would be a pain to have to go back and try to fix them all. Because to get Orchid you have to remove the DANedu package. If your package had all the same nodes, left the same way then I might do it. But its working and I dont want to mess with it at this point. Plus, if I remember correctly, to get Orchid I had to update Dynamo itself to 2.0 and that in-and-of-itself messes even more stuff up. So unless you know of specific problems with your DANedu nodes that you would like to point out, then please forgive me for not updating at this time.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [June 15, 2018, 1:05pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/6 "2018-06-15T13:05:31Z")

</div>

Hi @Dimitar_Venkov  
Looks like i must be doing something wrong with your solution because it does not work for me. Please see below.

Thanks @Vikram_Subbaiah that is a very simple and eligant solution. I should have thought of that! Thanks!

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

---

<div class="post-metadata">

**Author:** ![atharva.purohit466SX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/atharva.purohit466sx/32/116951_2.png) [@atharva.purohit466SX](https://forum.dynamobim.com/u/atharva.purohit466SX)\
**Post date:** [December 27, 2021, 12:06pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/8 "2021-12-27T12:06:20Z")

</div>

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

Hi Vikram ji,

If you see in my case I want to replace nulls in list(1) by the items in the list(2), without messing the indexes. At 41th position, the item should have been “CW\_drainageSystems\_pipe” but is actually “gully trap”.

Please assist.  
Regards,  
ap

---

<div class="post-metadata">

**Author:** ![atharva.purohit466SX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/atharva.purohit466sx/32/116951_2.png) [@atharva.purohit466SX](https://forum.dynamobim.com/u/atharva.purohit466SX)\
**Post date:** [December 27, 2021, 1:42pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/9 "2021-12-27T13:42:54Z")

</div>

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

Done using python.  
Thanks anyway!

atharvapurohit

---

<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:** [December 27, 2021, 7:39pm UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/10 "2021-12-27T19:39:45Z")

</div>

You could also try this.  
(This could be done with nodes too).

 ![replaceNulls_2021-12-28_01-06-49](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/6/a652efb0596685c53ffe63b3c998dac1e81fa8f1.png)

```auto
//Null Indices
in1 = List.AllIndicesOf(DSCore.Object.IsNull(ls1),true);

//Other Indices
in2 = List.SetDifference(0..List.Count(ls1)-1,in1);

//Flattened list of indices in sequence
ls3 = List.Flatten([List.Clean(ls1,false),ls2],-1);

//Flattened list of non null and replacements in sequence
in3 = List.Flatten([in2,in1],-1);

//Sort flattened list to restore order
ls4 = List.SortByKey(ls3,in3)["sortedList"];

```

---

<div class="post-metadata">

**Author:** ![atharva.purohit466SX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/atharva.purohit466sx/32/116951_2.png) [@atharva.purohit466SX](https://forum.dynamobim.com/u/atharva.purohit466SX)\
**Post date:** [December 28, 2021, 4:46am UTC](https://forum.dynamobim.com/t/how-to-replace-all-null-with-multiple-values/22837/11 "2021-12-28T04:46:58Z")

</div>

Thank you @Vikram_Subbaiah ji, but is this solution a bit complicated?  
I might be wrong, though.

br,  
atharvap
