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’.
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 Andreas’ approach is to convert first to a true/false boolean list and then replace those elements.
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: