community
cancel
Showing results for 
Search instead for 
Did you mean: 

Engine Works Blog

Under the hood of Alteryx: tips, tricks and how-tos.
#SANTALYTICS

Gather all 9 clues to complete the final Weekly Challenge on Dec 16!

Learn More
Asteroid

This comment asks how to create a simple batch macro in Alteryx.  Batch macros can seem very intimidating, but they are really quite easy to build once you understand how they work.

 

The 1st thing to understand is that you will be building 2 modules, not 1.  The batch macro itself is designed to process a single item, however you define item, and the module outside sends in a list of items.  In the case of this specific question, he would like to read a list of files, do some simple processing on them and then write them back out.

 

Since I don’t have the commenter’s data, I made a set of CSV files for each US State with the 2000 & 2010 Census population for each county.  For each file I want to read it in and then calculate the % growth in a new field and write it back out.

image

 

So to start, we make a module that does the processing we need for a single file.  This is a very simple module, it just reads a file and writes a file.  The next steps are just to make it a batch macro, add 2 control parameters, 1 each  for input & output file as well as making their corresponding actions.

 

 

At this point, we make a new module that will enclose the batch macro.  This module isn’t doing the processing, it is just producing the list of items to process.  A Directory tool, followed by a formula to create input & output file names followed by the macro we made above.  You can see from the below screenshot that it quickly loops through all the input files and processes them.

 

 

All the modules and input files can be found here.  As you can see, batch macros are not that scary after all…

 

Thanks for reading,

ned.

image

This post orignally appeared at http://inspiringingenuity.net/2014/02/12/alteryx-simple-batch-macros/#more-510

Comments

Hello, 

         How can i make sure to run my alteryx file at specific times of the day without using the alteryx scheduler  ? Is that possible ? Thanks in advance

Labels