# How to avoid this kind of warning?

**URL:** <https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [September 15, 2023, 5:30pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805 "2023-09-15T17:30:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 15, 2023, 5:30pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/1 "2023-09-15T17:30:28Z")

</div>

when list is empty, in fact:

1. i don’t yet understand the difference between ScopeIf node vs If node
2. what if i want stopping running rest of nodes? i don’t yet see the solution for conditional running  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/8/a8e876b13fec39e31b95f3588589efc7e08e5e31.png)

---

<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:** [September 15, 2023, 5:34pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/2 "2023-09-15T17:34:54Z")

</div>

You have two lists, one of which may be empty but not both; why not join the lists and then get the first item from each?

List.Create \> List.Transpose \> List.FristItem (@L2).

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 15, 2023, 5:49pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/3 "2023-09-15T17:49:11Z")

</div>

i have one list only which may be empty, when empty, List.GetItemAtIndex @ L2 will have warning, that’s common issue → warning but won’t affect running.  
seems 2 common issues yet to be resolved:

1. avoid warning even if it won’t affect result
2. conditional stopping

---

<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:** [September 15, 2023, 6:05pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/4 "2023-09-15T18:05:24Z")

</div>

Can’t confirm as we don’t have a data set, but the method I outlined above should give you the desired result, and won’t have any warnings unless both lists are empty.

There also shouldn’t be any need for a conditional stop; filter first and you should be all set.

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 15, 2023, 6:57pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/5 "2023-09-15T18:57:30Z")

</div>

i don’t understand your method, because i only have ONE list, based on that list, if it is empty, i will run List.GetItemAtIndex @ L1, if not, run List.GetItemAtIndex @ L2

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/a/cade5272a039f4c8a99e62ac71da9a45f4a89295.jpeg)

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 18, 2023, 4:14pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/6 "2023-09-18T16:14:09Z")

</div>

Node to Code will still give warning and conditional statement seems NOT working

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

what about Python i.e. any simple syntax without (nested) loop? below have syntax error  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/0/80e7c49d00e06a67af2088b2e0fee070f65f7deb.png)

---

<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:** [September 18, 2023, 4:50pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/7 "2023-09-18T16:50:03Z")

</div>

ScopeIf follows the logic you’re asking for (to an extent). It executes _only_ the input branch that matches the conditional.

However, this doesn’t work for your example since all paths are derived from the same start point (the empty list). Here you have circular logic the prevents anything from executing because the false branch traces back to the empty list that has to execute for the conditional and the true result.

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

Here, you can see that independent branches successfully pass on the correct result.

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

My question to you is, what are you expecting as your result and why do you need to prevent one branch from running? We need to know the actual use case you’re hoping for in order to help you solve this problem. There are some cases where ScopeIf works well and there are others where you really just need to redefine the logic to handle both conditions in parallel (and allow them to fail gracefully at times).

The python option is always valid. You would just have an if/else statement.

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 18, 2023, 5:45pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/8 "2023-09-18T17:45:18Z")

</div>

i have ONE input list which may be empty list, or plain list, or nested list.  
the warning won’t affect result but annoying or at least looks bad, this happens in many cases, just wonder if there’s a way to avoid.  
in fact, i don’t get used to Dynamo If (or ScopeIf) node, in traditional coding, true/false result should be at output ends instead of at input ends.  
yet to figure out the Python equivalent of GetItemAtIndex @ levels

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 19, 2023, 12:43am UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/9 "2023-09-19T00:43:50Z")

</div>

again, Python to the rescue!  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/9/791507e762182937496e524668b652a701da5059.png)

---

<div class="post-metadata">

**Author:** ![stefan.gokstorp](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stefan.gokstorp](https://forum.dynamobim.com/u/stefan.gokstorp)\
**Post date:** [September 21, 2023, 8:01am UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/10 "2023-09-21T08:01:52Z")

</div>

what your picture shows is basicly a test if list is empty get your list at level 1 (which is a flatten list of your originally input) that is to say if list is empty it will still be empty you only flattened it (which is nick means by circular logic)

it will probeably work for whatever you are trying to do but if list is empty it will be circular logic.

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 21, 2023, 2:03pm UTC](https://forum.dynamobim.com/t/how-to-avoid-this-kind-of-warning/93805/11 "2023-09-21T14:03:28Z")

</div>

right, logic is weak, should also check if nested list i.e. [1,2,3] → 1; [1,[2,3],[4,5]] → [1,2,4], Python seems fixed it, thanks
