Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Controlling the Order of Operations

Created on

Sometimes, especially when interacting with tools/files outside Alteryx, you need to explicitly control the order of tool execution. The classic example is a process whereby you 1) INSERT to a SQL table where an auto-incrementing ID is applied 2) read the records back in order to get the auto-incremented id 3) insert the auto-incremented ID into a different table.


In Alteryx worflow streams that terminate (as in an Output or Render), you can't reliably use Block Until Done to control the stream. One way to reliably control the order of events is with batch macros.


Batch macros guarantee that 1) every iteration is complete before the next iteration begins, and 2) that all iterations are complete before the macro reports itself complete. So if you place a process inside a batch macro and create an output stream from that macro, all processing will be done and the macro still can exist in the middle a workflow stream. You don't even need a Block Until Done as part of the process.


Please see the attached examples



Correct me if I'm wrong, but in the attached example I believe that the batch macro is inadvertently running once for every single record.  In this use case it isn't a large impact as the file is small and is overwritten on each iteration, but this could be an issue if running SQL or appending data.

The solution to this is to either use a sample or a summarize tool when connecting to the Control Parameter input in order to ensure that there is only one record coming in with the "batch" value.