Batch Macro
A Batch macro runs multiple times in a workflow, creating an output after each run. The macro runs once for each record or selected group of records in the data. Inputs can be configured to be used in each run of the workflow or only in specific runs.
Connect a Control Parameter Tool to configure a batch macro. Batch macros with more than one Control Parameter tool display a tab with input options for macro users. The tab does not display in the Interface Designer for macro creators.
Design a Batch Macro
- From the Workflow Configuration, select Batch Macro from the Workflow Type drop down.
- Configure the connected Control Parameter tool.
- Configure the Batch Macro Properties, found in the Interface Designer Window (Ctrl+Alt+D) or accessed from the View menu. Click the wrench icon to view the Properties.
- Output Mode: A batch macro will run, beginning to end, for each record that is passed through it and then union all of those iterations. You need to choose how to handle the union if the schema for each iteration is not the same.
- All Iterations will have the same output schema (Error if different): This is the simplest option; Alteryx just takes the schema from the first run and assumes the rest will be the same. If they are not, you get an error. The advantage here is that we don't need to wait for all the records to come through to start pushing things downstream.
- Auto Configure by Name (Wait until all iterations run): This will wait until all the iterations get run, and combine the schemas by putting fields with the same name into the same field. When they have different types, one will be chosen that can hold all the values.
- Auto Configure by Position (Wait until all iterations run): This will behave like Configure by Name, but fields are matched up by their position in the record. Field Names will be set based on whichever iteration is the first to have a field in that position.
Once the workflow is saved as a Batch Macro, each tool in the workflow gets a lightning bolt anchor . Only Interface Tools can connect to these anchors.
Additional Inputs
Some batch Macros have additional inputs. If additional inputs are specified, a Grouping tab displays. By default, grouping is not specified, and each iteration of the workflow gets all records from the additional inputs. When Grouping is specified, the additional inputs only receive records which match the Control GroupBy field for that iteration.