Stephan Moenninghoff 386 Posted February 1, 2017 Is it correct that the if node fills up the false output with the last index to match the list length of the true output? Should I have to run the "Delete Dups" node (thanks @DomC! ) after each if node to prevent this from happening? Quote Share this post Link to post
Marissa Farrell 464 Posted February 1, 2017 Most nodes will repeat the last item of the shortest list when they are run, which is what you are seeing here. Deleting duplicates would be a good way to fix those errors, as long as there aren't any others that would have the same value that you would need. Another way to handle this would be to return the first x number of items in the list, with x respective to the length of the shortest list. You could probably use the 'Split List' node to do that. 1 Quote Share this post Link to post
Patrick Winkler 47 Posted February 1, 2017 (edited) Yes if a node does not provide the requested amount of output the last item is repeated as much as needed. It would be helpful to see what happens before the splitnode in your network. It looks as the Delete Dups node does not keep the order. I created a similiar node where I solved this problem with an Ordered Dictionary: remove_duplicate_items.vwx Edited February 1, 2017 by Patrick Winkler 1 Quote Share this post Link to post
sbarrett 227 Posted February 1, 2017 Here is a version of the If node that I use - if the length of the true values, false values, and test values are all the same, it works the same as the original If node. if the lengths of the values are not the same, it takes the first value of the test values and uses that to determine which list of values (true or false) will be sent through the node. For example: True values: [1,2,3,4,5] False values: [A,B,C] Test values: False Then the result would be [A,B,C] Ifv2.vwx Quote Share this post Link to post
DomC 315 Posted February 1, 2017 @Patrick Very useful node for different use cases. Dragged in my Node-Library ... Thanks for sharing. Quote Share this post Link to post
Stephan Moenninghoff 386 Posted February 2, 2017 Thanks everyone for the comments and custom nodes. @Patrick WinklerI hadn't even noticed that the order of indices got shuffled. As a matter of fact, it does not even matter for this project. I'll still install your custom node in case I need it for a future project. @sbarrettI'm installing yours as well. It's always good to have a few options to choose from. Thanks again to all! Quote Share this post Link to post