DataShape - MultipleInputForm runs even if I cancel it and dont press run?

Hey!
I have made a script which exports some data to excel, when i run the data-shapes MultipleInputForm interface. My problem is that if I close the interface and DONT run it, it will still run. Does anyone know how to make it not run when closing the interface?

What interface are you closing and what is still running? If you’re closing the Data-Shapes UI then the node already has inputs and defaults to run. If you want an option to not execute the rest of the script then you need to provide the optional Cancel input and use that. The node only checks whether the input UI was canceled or not.

When I run the script with the settings above I can “Export” my data. If I “x” and close the interface window the script still run. If I add a “Cancel” button to the “CancelButtonText_optional” it will still run if I press “Cancel”. Maybe it is something with the output of the MultipleInputForm, but I am not sure…? :slight_smile:

Set up the Cancel Button option and use the “Was Cancelled” output to control the information with an if statement. If the “Was Cancelled” output returns true, then pass an empty to next nodes instead of the “User Inputs” output. Or you can do the same with the “Was Run” output.

EDIT: Correct as @Nick_Boyts states and I failed to mention. The script will still run, but it will throw an error instead executing the data like normal.

1 Like

What @staylor is saying. Cancelling the Data-Shapes node only cancels the inputs. Your graph will still fully execute because that’s how Dynamo works. If you want to prevent any other downstream nodes from executing you have to handle them separately.

1 Like

I am not totally sure what you mean. I have set up this now. When i “cancel/X” the UI the if statement show true. Very nice. But the script still exports the excel file. How will I get from a If-node which has the result=true to a message showing up which says “Cancelled”?

It does not work when the “script” is placed in “Was Run”, so I guess it has to be in the “User Inputs” for it to work properly.

The setup would be similar to shown below. The If test input is the result coming from the “Was Run” output. If that is false, then " " is passed along and the rest of the script will fail (run with errors). If “Was Run” is true, then the user inputs are passed along and the rest of the script will execute correctly. Or you could use the “Was Cancelled” output for the test input, but you would need to swap the true and false inputs going into the If node.

If you want the script to run without errors either way, you will need to handle the rest of the downstream nodes individually as @Nick_Boyts suggested.

1 Like