If empty continue

Hi,

I have a node, connected in a list.
But, i’ts not all the time that will have list.
In this case, the list is empty, and all others nodes are with error.
I need something like in VBA Excel… ON ERROR CONTINUE…
or, if listy is empty, create a empty list…

all final nodes is going to a LIST.JOIN… if there is an error, all list stay with error, and i cant this.

image

image

Not sure if i fully understand but here’s what i came up with

1 Like

Daniel,

Thanks for your help, but, it’s not this.

Is amoust.

I need something like this:

Im confused about the List.Join. Are you trying to add the empty list at the end of the not empty ones?

When the list exists:

When the list is empty:
image

And if you don’t need to keep the list structure (ie. you don’t want the empty list in your List.Join output) you can remove the codeblock before the true input and pass your list directly into the If node.

3 Likes

Thanks Nick!!

You got it!

Nick,

There is a problem…

I just changed list.isempty to object.isnull…

In this case, all lists are FALSE, so… the LIST.TRANSPOSE should be all in the node IF.

But, is showing only the first one.

You’re kind of changing what you’re looking for. I assume you’re looking for a case when one of the transposed sublists contains a null, correct? You’ll have to do a little more list management in that case.

I got it by other way…
but, this is very confused…

I can’t see why:

LIST.ISEMPTY is TRUE,
so, the node IF, should show the result to the TRUE, in this case “A”.

But not… is Empty List :frowning:

I think it’s because the list IS empty. If statements require the same number of elements in both the True input and the False input. I’m guessing the node is basically seeing one (1) True input and (because the list is empty) zero (0) false inputs. That’s why I had to convert the Empty List to a list originally.

This only seems to be a problem when the first item is empty. (This is a common problem with certain nodes not being able to handle Empty Lists or Nulls in the first index.)

It’s just kind of a dumb thing that Dynamo has trouble with. Your best bet is to use a simple Python script to do it for you.

list = IN[0]
replace = IN[1]
out = []

for l in list:
	if l == []:
		out.append(replace)
	else:
		out.append(l)

OUT = out

Not worked.

image

It requires a second input for the replacement value of an empty list.

Got it…

I read the script … learning a little of Python Kkk

try the scope if node or use a conditional in a code block node if you don’t want to use python.

1 Like

Hi, welcome to 2021! I just got the same idea with you. But I don’t know how ScopeIf works.

In my case, I want to pass “nul” Data if it’s empty. I’ve tried with four solutions.

  1. use If condition, and connect “in” to false, it didn’t work, as @Nick_Boyts said, I need to give something to both “true” and “false” input.
  2. use If condition, and connect “1” to false, it worked only if the Data is epty.
  3. use ScopeIf condition, it worked but I don’t understand how it works :slight_smile:
  4. use Python, it didn’t work, i don’t know whether IN[1] doesn’t accept “null” or no.

The python node is expecting a list of values and empties to convert. You are supplying a straight empty list. It’s a different list structure.

Will your input be a single object or a list? If you plan on always providing a single object then you can just convert the empty list directly with OotB nodes or remove the for loop in python.

Finally, I understand.