This is the second post in a series aimed at making the three types of macros in Alteryx accessible to anyone: standard macro (see it here), batch macro and iterative macro.
This post will cover:
- Batch macro:
- The obscure Control Parameter
Put it simply, a batch macro is a regular macro that will run multiple times, each using something different as input. One could also see it as a “For loop” in Alteryx:
For each item run the macro and combine all the results
Whenever you want to run a macro (when and why?) but you have multiple inputs that you want to process. Maybe there are multiple URLs that need to be fed to an API. Or multiple files to be processed (maybe with different schemas). Or multiple employees to be analyzed within a macro. For all those cases, the batch macro is the solution, but the secret sauce is the…
The key controller of the batch macro. Without it, you have just a regular macro. Add the control parameter and it will update whatever value within the macro to run it as many times as inputs available.
This workflow will go through a list of ID and perform a series of operations based on a match with a provided ID.
It can easily be updated to a standard macro by changing the input/outputs.
And then upgraded to a batch macro by including a control parameter that will update the ID I am checking against.
Once saved, it can be inserted into another workflow, but it will throw an error until the control parameter is properly mapped.
In this example, I do not have just one ID, but many. And I want to run the Alteryx macro once for each ID present in my list. How? Just connecting my list of IDs to the macro query anchor (¿) and going to the configuration window and selecting the correct field to map in the “questions” tab.
After running the macro, the output will be combined in a single table (union) and all iterations will have the same schema (this is the default setting, but can be modified in the Interface Designer > Properties tab)
Have a look at one example of a well documented batch macro combined into an Analytic App by Marc Reid
Any comments, please leave them here or reach me at @dsmd4vid.