How to change workflow path or stop it

Hello,
Is there any node or something that I could use for change the workflow path while it is running? For example, some node has its output is linked to 2 different group of nodes and, if the input for this node is true, the workflow flows to the first linked group of nodes and if it is false, the workflow flows to the second group. I’ve attached an image to explain it better.

Another option would be a node that stops the workflow if the input is false and keep it running if its true, for instance.

Thank you!

I would like to know also.

The If node?

4 Likes

Thanks for your reply, but that is not what we need. I would need something like this but with 2 outputs and then, depending of the input, just one of the outputs would return something and the workflow after the other output would stop running…

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.