Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Dynamically enabling / disabling workflow sections


The Detour Tool allows alternative workflow paths to be run according to its design-time configuration. However, there are some cases where it doesn't allow the amount of control you need. The first case is where you need to programatically change the path based on the data in the stream at runtime. The second is when you have workflow streams that you may not want to be connected into a stream within a Detour and Detour End (as in the case of Inputs and Outputs).


For these cases, a better solution may be a batch macro controlling enabled/disabled tool containers within the macro. Disabled tool containers disable any tools within them. Batch macros allow dynamic control of virtually all tool configurations, including the enabled/disabled state of tool containers. Together, these two features can enable full dynamic control of workflow sections.


A simple batch macro design would look like this:macro_design.png


The Tool Containers will alternately be enabled/disabled by the Actions being fed by the Control Parameter. The Union gathers together whatever streams are present, and sends to the Macro Output. (Note that you may need to configure your macro to allow changing output fields (via Interface Designer) if your schema changes by condition.) Please see attached functional example.

9 - Comet

This is an awesome solution, thank you!

8 - Asteroid

This is a great solution - so simple, too!

I had a much more cumbersome solution that was not reliable and took 10 times longer because of the behavior of the filter tool (letting the workflow continue for the false cases as well.

7 - Meteor

@DanH I have a question. Firstly, thanks for the post, this helped me a lot get started with my problem.

However, in my case the "Macro Input" is not a file or a query, but a whole workflow. I am trying to union some things and I want to execute different workflows on the data that come out of the union, and not the initial data. 

In specific, if this union has 0 rows coming out, then I want to add a column saying that nothing was changed. If there are rows coming out of the union I want to add a column saying that something has been changed. 


I follow your steps, except when I try to make the macro I don't know what to put before the two different tool containers. Here are the two images: one of the workflow and one of the macro

macro image.JPG

workflow image.JPG



Hi @aveloudi . Sorry for the delayed response... I just saw your post. 


If you have no records coming out of any tool, but you need records to operate on for a decision (like to control a macro action), you need to make a record from nothing. In your example, Record ID tool won't create a record with an ID of 0 in the case of no records coming into Record ID. Instead, you could use the "Count Records" tool, which returns a record even when no records are fed to it. Once you then have this record, you could use it to influence downstream decisions like macro actions, filters, appends, etc. 


Also, in my example, I'm turning Tool Containers on/off dynamically based on the incoming data via a Control Parameter, and I'm also showing that I can use incoming/outgoing data streams within each Tool Container. However, you do not have to define/process an incoming data stream or provide any output stream from the macro. The contents of any Tool Container within the macro can be completely isolated if you need, and can obviously reference other self-contained macros. Here's an example:




I hope this helps!



7 - Meteor

Hello Dan,


It would be great, if you can share the workflow. I have doubt in control paramater configuration to make this macro work.