Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
8 - Asteroid

Batch Macros are a major new feature that very few people will ever notice or use. We have gotten a lot of requests for looping features in Alteryx. People request this without think (or even knowing) about the programming model for Alteryx modules. An Alteryx module is in effect a functional program. Looping in its traditional sense is only seen in procedural programming languages. For more info about these programming styles, see Functional_Programming and Procedural_Programming.


Unfortunately, it's not good enough for me to tell customers that looping doesn't fit in the model that is an Alteryx Module. They still have a job to do and Alteryx is so close to being able to do it. For a few customers we have helped them write a wizard to accomplish part of their task and then shown them how to write a .bat file and use the RunCommand tool to run it from within Alteryx. It's hardly an elegant solution and is very difficult to deal with temp files for input & output.


Enter Batch Macros: a Batch Macro is a special kind of macro that is designed to be run repeatedly in the context of a module. It takes a special input called a control input that maps fields to questions for reconfiguring the macro. For each incoming control record, it will run the macro beginning to end. The macro can also contain outputs that will be merged into a single stream. Additional inputs work in 2 ways - either all records from an input can pass to all iterations or you can group the records, so each iteration only gets records appropriate to the group.


If that sounds fairly complex (and believe me, it is), the good news is that a user of a Batch Macro doesn't really see anything different than any other macro or tool. The complexity is entirely in the macro designers side. This means that while our customers power users or our professional services will be the only people to design Batch Macros, anyone will be able to consume them with no special knowledge.


So how about an example? A specific customer request we have gotten was to be able to make non overlapping trade areas around each store with different parameters for each sales territory. Furthermore, they did not want stores in different territories to interact with each other while building the trade area, because all trade areas would be clipped to the sales territory boundary. This is of course easy to do now, 1 territory at a time, but there is now way to run all territories at once. Enter Batch Macros. Since the batch macro runs beginning to end, for each territory, we can easily accomplish this in a single run.

Batch Macros are functional in the current Beta and will be released in 5.0. Look for a few other versions of Batch Macros in the future as well.