A Batch of a Macro

by Rachel Phang

First things first, what is a batch macro?

A macro in Alteryx is a workflow that has been grouped together into a package or stand-alone module. Macros in Alteryx have a .yxmc extension. A user might want to create a macro in order to run a process regularly or repeatedly. They look like tools themselves and can be used like tools, with a single configuration interface, inputs, and outputs. The three types of Alteryx macros are standard macros, iterative macros, and batch macros. While a standard macro runs through a process once from start to end, an iterative macro runs through a process repeatedly until a certain condition has been met.

A batch macro, on the other hand, runs through a process from start to end subject to inputs from a control parameter. The control parameter contains questions that map to fields that in turn reconfigure the batch macro with each run. Not to be confused with Spanish, the input on the macro that feeds into the control parameter from the workflow where the macro has been placed looks like an upside-down question mark.

The Alteryx Control Parameter tool icon

The Alteryx Control Parameter tool icon

control parameter input

Not to be confused with Spanish

 

Dataset

The dataset I used for this batch macro was an API feed from the open data source about crime and policing in England, Wales and Northern Ireland from data.police.uk. This data set is the first data set from the Data School’s “Dashboard Week“, a week-long challenge of producing a workflow, a dashboard, and a blog post each day.

How it works

I like to think of the macro being a bit like Super Mario, with the upside-down question mark showing where Mario goes down a pipe into a different world temporarily (your workflow gets diverted to run through a different process), and when it is complete, the output emerges from the macro output arrow. That said, as this is a batch macro, Mario keeps going into the tunnel (perhaps looking for more coins?) until the control parameter has cycled through the input fields.

In the case of this workflow, the data set that was cycled through was monthly crime data, but the API could only handle one date input at a time. The process that needed to be batched or cycled through, therefore, was to update the API call and download the data one month at a time for all the months within a user-specified range.

Batch macros a bit like Super Mario

A bit like Super Mario

Avatar

Rachel Phang

1 mins read

Tue 23 May 2017

2 mins read

Sat 22 Apr 2017