We are aware of an issue with the Search bar. Please use Advanced search for the time being while we troubleshoot. Thanks for your patience as we work on improving the community!

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Detour based on Count in a Macro

7 - Meteor

I am running a macro to parse out XML files that are not always consistent.  This requires me to detour through some of the workflow if under one run there are no records (i.e., using the Count tool equating to zero) and detour through a different workflow when it is not equal to zero.  I assumed I would use the Detour and Detour End tools for this but I don't know how to pass the updated value using the Control tool and Action tool to do so with an Update Value With Formula.  It seems that when I determine the Count, I cannot apply it in the formula.  Any ideas?

9 - Comet



There are at least a couple of ways to do branching like this.


Method 1) For a single workflow solution you can do the Count Records, then a Filter for Count > 0. Then the True output can be the source for an Append tool that then gets the original records appended to it. When there are 0 records then no records passed and the Append tool then returns 0 records (and a warning) whilst the False output out the Filter continues onwards with one record (the Count = 0): Here's a workflow:


Screen Shot 2021-01-05 at 10.18.49 PM.png


Method 2) We can't directly use data in order to redirect a Detour Start tool. In order to redirect a Detour Start tool we need to use a configuration output aka interface question from one of the interface tools, or a control parameter. Since the count is coming from a data stream then we need to use a control parameter; control parameters are the only way I know of to turn data values into configuration values. And when we use a control parameter that means that the logic affected by the control parameter needs to be embedded into a batch macro.


The flow I built for method 2 is attached.





7 - Meteor



Method 1 doesn't work for me because at the point where the count is performed, the only record left is whether count = 0 or some other value.  I don't really care about the count, I care to branch the workflow based on whether there is a value or not.  I am already in a macro to run this because it is an iteration across multiple XML files and when running through the loop, I do not know whether specific field has values or not.  If they are present, then the path will be using the data from a 'True' statement, if they are not, they are through a 'False' statement.  I had an interface question through the use of a control and action parameter.  I just don't know how to formulate the Update Value With Formula to get the detour to toggle between true and false.


The workflow you attached was for Method 1 and not Method 2.


Unfortunately, I can't send the workflow or I would to show what I'm doing.