How to avoid this kind of warning?

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

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).

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

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.

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

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

what about Python i.e. any simple syntax without (nested) loop? below have syntax error
image

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.

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

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.

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

again, Python to the rescue!
image

1 Like

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.

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

1 Like