LOADING

Type to search

3 Different Ways to...

3 Different Ways to… Update an Input in a Batch Macro

In my second post in the three ways to do something in Alteryx series, I take a look at how to update a value in a batch macro.

For those who are not familiar, batch macros are a way of applying the same process to a record / row of data before moving onto the next record. They are different to iterative macros where the output of one iteration then becomes the input for the new iteration. Also batch macros are defined by having a control parameter which is used to pull in the value (parameter) for each record.

In this example we look at how to update a input file in a batch macro.

#1 – Input Data Tool

In this first approach, the control parameter is connected to a file input tool with an action tool.

Due to the action tool being connected to a file input tool the configuration of the tool has an option to “Update Input Data Tool”. This is a straight forward way of setting up the batch macro as it replaces the file without needing to specify a template file (i.e. you can switch between different file types if you want to).

#2 – Update Value

In the second approach, the action tool updates the value of the file input path.

A benefit of this approach is you can allow the user to either input the entire file path into the control parameter (as shown), or you can limit which part of the string can be replaced. This is helpful if you want to control the file type or the folder where files can be read in from.

#3 – Update with Formula

For the third approach, the action tool is set up to update with a formula

This provides a nice clean set up as you only need to specify [#1] in the expression. This can be a bit cleaner as it will get all the information it needs directly from the control parameter.

So there’s three ways to pass the value from the control parameter to update the input file for a batch macro, which way do you prefer and use?

Tags:

You Might also Like

Leave a Comment

Your email address will not be published. Required fields are marked *