If-Then/Run Tools

If anyone has ever been frustrated by the “If” Node and its inability to lace the longest list, then this topic is probably for you. For a while, I was using “Ayuda.ThisOrThat” from the Rhythm package, but eventually this node was depreciated. Usually this was for signaling a script to run or sending an empty list.
At first, I tried using “Tool.RunMe” from SteamNodes to do this, however this custom node produces a zero when given a “False” input, which using sends an error through the rest of the graph and makes it look like something wrong has occurred.
There’s also the “ScopeIf” Node, which tends to offer buggy results unless used under very specific circumstances.
Nice thing is, I found a rather elegant solution of my own! It also doesn’t require any packages or python to implement.


There you have it, simple as that. You use the basic “If” Node to produce an index, which can then be pulled from a list of two lists. Usually, passing an empty list doesn’t produce an error, so the outcome is still clean. Here is the same thing simplified in a single code block below:

Of course, the Empty List can be switched out with a completely separate one and none of the results even deal with any shortest or longest lacing issues.
Try it out if you feel stumped or would just like a way to simplify your script.
Paste into a Code Block:
//Run Tool
List.GetItemAtIndex(
[send, List.Empty],
run? 0: 1);

5 Likes

Great work-around. :smile:

List.FilterByBoolMask is another great way to alter data flow like this. It also maintains the ‘out’ items separate from the ‘in’ items - just split your data flow at that point and go.

2 Likes

dcmasten1, I do really thank you, it is the exact what I want!!! I do appreciate your help mate, I tried it and it is perfectly working :slight_smile:

Firas S. Noori

1 Like

thanks

1 Like

dcmasten1, I do really thank you, it is the exact what I want!!! I do appreciate your help mate, I tried it and it is perfectly working :slight_smile:

Firas S. Noori

1 Like