How to change workflow path or stop it

The suggestion by @viktor_kuzev actually does just that.

There are others ways to do similar (and more complicated things) with code and functions, but if you’re looking for a node. This should work.

His suggestion gives me 2 different values in the same output, the output value depends of the input, that is true. However, I have 2 workflows after the node, and what I need is that, depending of the input, just one of the workflows woud keep running and the other one would stop.
I will try to make ir more clear with some images:

Again, that’s what the IF node does.:slight_smile:
It’s just that the two possible results are fed as inputs.
Assuming I haven’t misunderstood your intent, hope the below illustration helps clarify.

Thanks for your help, but you are not understanding me. I need the workflow to not be executed if the input is false. I dont need the output to show me the values for true or false, I need it to stop the execution of the nodes if it is false. just like I’ve shown on the last image I sent. Something like: “if it is true, keep the workflow running, if it is false, freeze the following node”

use a scope if node or use an imperative block with an if statement in it. (using a code block)

you could use two If nodes and edit the two workflows so you have an input that depends on the result of the if:


In one case it won’t execute further because of faulty/dummy data fed in.

2 Likes

Thanks for that, it stops the workflow as I asked. However, I thought there could be a way for doing it without warnings after, like freezing the node while the workflow is running, but I reccon there isn’t.

Don’t know if it’s helpful, but you can actually store functions in a dictionary.
That way you can apply different functions depending on some kind of metric/boolean value etc.

6 Likes

Tool.RunMe from steam nodes would prevent the error you’re concerned with.

4 Likes

That’s a good topic actually. When evangelists of Dynamo say “You don’t need to script” they lie a little bit. A script has a straight order of how it is executed. You can break, switch or loop this flow explicitly. This gives you a natural and advanced control on your program.
Visual approach is more about transformation of some data as a whole. You can think of it as of one “arithmetical” function which has variables, parameters and outputs. You see connections between them but there is no explicit execution order, which you can change. This is the main difference between visual and scripting approaches. If you look at the most useful nodes in packages, you’ll see that most of them have python scripts inside.
Nevertheless, Dynamo has original nodes for loops and even transactions, but I’ve never seen someone using them, neither even their description.

1 Like

My topic is little bit related to this. I have to set of list for example X list and Y list. My intension is, if the width is greater than length (false) then X list output is same but Y list has Y+100 value. If the length is greater than the width (true) then Y list is same but X list has X+100 value. It is possible in dynamo.

Yes it is possible, and best accomplished with an if statement. Please start a new topic as it’s only a bit related and this thread is rather old.

I create a new topic can u pls see it.
https://forum.dynamobim.com/t/get-geometry-location/17794/4

Hi. Did you ever get a solution to this? I need to do the same thing. Thanks.

1 Like

Hello @ricardoperucci and @jacob.small,
I have the same problem. I have two workflows with the periodical setting; I want to always run the first one but not the second one; I need the second workflow to be run once out of every ten runs. In other words, when I set the periodic time for 1 second, I want the execution of my first workflow every 1 seconds, and the second workflow every 10 seconds.
I attached the code I created, here. Basically, one out of ten runs it returns [time, time] and the other 9 it returns [time, ‘false’].decision maker.dyn (5.1 KB)

This code is basically the solution; Some minor case specific edition needed to be done.

I just posted something about this today, basically I create a gate and send the list through based on the true/false toggle.

Could als be used with multiple Boolean and logic gates.

Just add another if result mode and swap out the true false inputs.

Here is how I have solved it; uses the Steam Tool.RunMe node.

Thank you, that works perfectly. The original 2 code blocks I switched for a simple boolean, then I renamed it so that the user is aware of what it triggers, it works perfect and your solution provides a clean and simple interface for the user at the Dynamo Player. Kudos to you and thanks again

1 Like

Danbash, thank you for this idea.
However, I have no clue why it does not work for me - I saved the script, re-open etc.

Basic workflow task: I want to hide selected elements, when the toggle is “true”, and unhide all selected elements - when it is “false”.

Thanks