# Loop while value is not null

**URL:** <https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986>\
**Category:** Lists-Logic\
**Tags:** loop, dynamo\
**Created:** [June 10, 2021, 1:52pm UTC](https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986 "2021-06-10T13:52:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![renanemeyer](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/renanemeyer/32/114498_2.png) [@renanemeyer](https://forum.dynamobim.com/u/renanemeyer)\
**Post date:** [June 10, 2021, 1:52pm UTC](https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986/1 "2021-06-10T13:52:39Z")

</div>

Hello everyone.  
I’m frozen at the end of a routine.

 ![AAAA](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/f/ff415c80588734f4b6292100f2b36dcfb42b320a.jpeg)

I need the value to be included in the “Value” of “Element.SetParamterByName” do a loop:  
If “A-01” is Null, continue reading to “A-03” and enter the first non-null.  
How do I do this in dynamo? Does anyone have a suggestion?

---

<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:** [June 10, 2021, 2:16pm UTC](https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986/2 "2021-06-10T14:16:01Z")

</div>

I don’t quite follow you, but it looks like A-02 and A-03 have no values at all. Can you show us an example of what you’re expecting?

---

<div class="post-metadata">

**Author:** ![renanemeyer](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/renanemeyer/32/114498_2.png) [@renanemeyer](https://forum.dynamobim.com/u/renanemeyer)\
**Post date:** [June 10, 2021, 2:30pm UTC](https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986/3 "2021-06-10T14:30:32Z")

</div>

![situations](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f9c438bf7e693d3123715c4f7f84f2ee80b4ed8b.jpeg)

Nick, thanks for answering.  
I do 3 situations that can be result at looped.

---

<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:** [June 10, 2021, 2:42pm UTC](https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986/4 "2021-06-10T14:42:07Z")

</div>

Like this?

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

You could also use `IsNull` to filter the nulls from your list and then just take the first item from the non-null values.

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

---

<div class="post-metadata">

**Author:** ![renanemeyer](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/renanemeyer/32/114498_2.png) [@renanemeyer](https://forum.dynamobim.com/u/renanemeyer)\
**Post date:** [June 10, 2021, 2:49pm UTC](https://forum.dynamobim.com/t/loop-while-value-is-not-null/64986/5 "2021-06-10T14:49:37Z")

</div>

Excellent!!!  
Was great with the script.  
Thank you so much for this
