Skip to main content

Batch Macro

A Batch macro runs multiple times in a workflow and creates an output after each run. The macro runs once for each record (or a 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

  1. From the Workflow Configuration tab, in the Type section, select Macro > Batch Macro. Once you save the workflow as a Batch macro, each tool in the workflow gets a lightning bolt anchor. Only Interface Tools can connect to these anchors.

  2. Configure the connected Control Parameter tool.

  3. Configure the Batch Macro Properties via the Interface Designer Window (Ctrl+Alt+D), or accessed via View > Interface Designer. Select the gear icon to view the Properties.

    • Choose either the default Standard Icon or select Custom Icon to upload your own.

    • Help: Use File or Hyperlink: A relative path or URL to a custom Help topic for an app or macro. The default Help page is either Analytic Apps or Macros. The referenced topic displays when a user presses F1 or selects the tool and selects the Help icon in the Configuration window.

    • Output fields change based on macro's configuration or data input: Select this option to make the macro remember the output fields from the previous run. To reset the output fields to the default values, change the macro configuration.

      Select this option if the output fields change based on the data passed to the macro. Do not select this option if the output fields only change based on input fields or question answers.

    • Output Mode: A batch macro runs, beginning to end, for each record that is passed through it and then unions 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 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 are 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 are set based on whichever iteration is the first to have a field in that position.

Additional Inputs

Some Batch macros have additional inputs. If additional inputs are specified, a Grouping tab displays. By default, the 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 that match the Control GroupBy field for that iteration.