ReplaceByCondition not working on empty list

Hi

Can someone explain why the ‘ReplaceByCondition’ node wouldn’t be working on an empty list? Even Clockwork’s ‘List.ReplaceEmptyLists’ is not working as expected. I simply want a conditional statement to replace an empty list with ‘0’.

emptyLists.dyn (17.0 KB)


Maybe you can verify your question… hmmm

KR

Andreas

Hi Paul,

The out of the box node requires an applicable Function to be passed into the condition input to work. While the List.IsEmpty node returns a function, its condition isn’t met as the result will be True or False, and the List.Empty node doesn’t return a function as it has no input ports.

To solve this now, you can either use the Clockwork List.ReplaceEmptyLists node or approach :slight_smile: Andreas’ approach is to convert first to a true/false boolean list and then replace those elements.

You’ve lost me on this. Isn’t True/False exactly what you want there?

In any case, can this be fixed in the next release please.

I think this doesn’t work because of replication:
this is replace -

it takes var - not var[]..[]

an empty list has no items and my guess is that the function doesn’t get called at all since there is nothing to replicate over.

Try calling it over [[]] a list of an empty list.

1 Like

hi @Paul_Wintour

the reason I think it is not working is that when you use list as the item in ‘ReplaceByCondition’ node, it will compare every item in the list not the list itself so since the list you used in the item is empty, there is nothing to replace so it will just output an empty list. if you want to replace an empty list with a value you can use the following: