In this blog, I aim to focus on the fundamentals of macros. We will be covering definitions, types, and a step-by-step guide in building a macro.

 

Defining an Alteryx Macro

A macro is a collection of tools consolidated into a singular tool. Essentially, they package up a process to automate a repetitive task which can be used in other workflows. For example, the following figure illustrates the macro for the Data Cleansing tool:

 

Types of Macros

One method to set up a macro is by changing the workflow configuration. As you will see, there are 4 different types of macros to select from in the following drop down list:

In our DS training so far, we have covered 3 out of the 4:

  • Standard Macros: set of tools that perform a task which are packaged up into a single tool.
  • Batch Macros: runs a macro for a set of records and unions the results together.
  • Iterative Macros: runs a macro through every record and loops the records back to the start and repeats the process until a certain condition is satisfied.

For simplicity, we will be building a standard macro in the next section. I promise it will be nothing complex like the Data Cleansing tool!

 

Creating a Standard Macro

The purpose of the macro we are creating will be to change the text case of a particular field. We will configure the macro with questions using interface tools which will allow the user to select either lowercase, uppercase or title case. For example, if our dummy data is “My name is Oliver”, then I want the macro to be returning “my name is oliver”, “MY NAME IS OLIVER” or “My Name Is Oliver” respectively. Follow through the steps and figures below to build the macro from scratch.

Step 1: Drag and drop a Macro Input tool from the Interface palette to the workflow.

Step 2: For this example, I will set up our dummy data which will be manually configured in the Text Input. Ultimately, our dummy data is used to test out the logic of the macro.

Step 3: Drag and drop a Formula tool from the Preparation palette to the workflow. For now, the LowerCase function will be used as our expression. This will later be configured by the user.

Step 4: Drag and drop a Drop Down tool from the Interface palette to the workflow. Anchor this tool to the “lightning bolt” icon and an Action tool will automatically appear.

Step 5: Edit the configuration windows for both the Drop Down and Action tools as shown.

 

Step 6: Add the Interface Designer window via the View menu bar. Click on Properties and the following pop up will display. In this demonstration I have selected a custom icon using a collection of sushi as the image for the macro tool.

Step 7: Run the workflow to test the logic with the dummy data, ensuring there are no errors.

Step 8: Save the macro, open a new workflow, then insert it (right click onto the workflow canvas) to test the macro with a new dataset.

 

 

And there we have it! We have now built a standard macro that is designed to change text cases.