What Are Batch Macros?
If you're familiar with coding, you can think of batch macros as like a 'for loop'. If not, that's fine too. You feed a batch macro values one at a time, it completes a given series of operations and returns an output after each run. The values are fed to the batch macro one at a time through a control parameter tool.
Example
To better understand this, let's look at example (taken from Alteryx Weekly Challenge #11).
Here's what our two input datasets look like:
A list of complaints:

And different buckets along with their identifying keywords:

Our task is to look for the search term for each of these buckets in the list of complaints and count up the different combinations of buckets the complaints fall into so we end up with:

One approach to tackling this is with a batch macro! Since we want to run a given series of operations for each bucket on all of the terms and we know that the same complaint can fall into multiple categories, this seems like a sensible option.
We are hoping to achieve something like this:

Now let's look at how we do this in Alteryx!
Let's start by setting up the operations within the macro and making sure they are working as intended.

Here, I've set the input as our list of complaints, using a filter to manually check for just one of our search phrases and then formula tool to create a new column, manually assigning the relevant bucket name.
Once we're sure that the base series of operations are working as intended, we can move on to making the search term and bucket name dynamic. We can do this by attaching control parameter tools to the lightning bolts on both the filter and the formula tool as shown below.

Be sure to rename these for ease of use later:

We need to point these to the relevant values to replace in the filter and formula tools. This is done by configuring the action tool.


Once we've done this, we can convert our input and add our macro output.

Finally, we can double check in the workflow pane that this is being recognised as a batch macro.

Great! Now that the macro is configured, we can move onto the main workflow, see the completed version below.

Here, we point the complaints data to the input anchor and the bucket names data to the control parameter anchor (upside-down question mark). We then need to configure the macro so that the relevant columns are used for each respective control parameter.

If we check the results of our macro:

Great! We can see we have a list of complaints alongside the bucket that they fall in to. Now we just need a couple of aggregate steps to group first by Complaint ID and concatenate the Buckets and then by the concatenated buckets to get the output in the format desired.

Hopefully this has been a useful example of what Batch Macros are and how they can be used.
