Macros and Analytic Applications are advanced topics in Alteryx—they fall under the Designer Advanced Certification. Luckily, the community has many resources to guide you on this learning journey.
So, what is a Macro? A Macro is a workflow or group of tools built into a single tool that can be inserted into another workflow. Macros allow you to run records or groups of records through a process and even loop through processes when needed. Creating a Macro will also save an analytic process you perform repeatedly. Once created, you can insert Macros into a workflow without having to recreate the looping logic or copy and paste the sequence of tools each time.
And how about an Analytic App? You can use an Analytic App to execute a workflow without having to open the workflow itself. Apps allow you to design a user interface for running your workflows, where users can input values that update parameters inside the workflow. Apps are great tools for end users who do not have Alteryx experience, as the interface allows them to interact with the data process without needing to know the ins and outs of adding or configuring tools on the Designer canvas itself.
Here is a summary of some of the differences between these solutions:
One of the similarities between Apps and Macros is that you use Interface tools to build them. To learn more about Interface tools, check out the help documentation.
The Interface tools
The Action tool allows you to update the configuration of your workflow with values from the interface tools. Take some time to review this tool mastery article if you are unfamiliar with how this tool works.
Another similarity between Apps and Macros is that the Interface Designer Window can be used to customize the App or Macro interface. You can find the Interface Designer under the View tab in Alteryx Designer.
The Interface Designer allows you to:
Add and delete interface design elements (like group boxes to group questions)
Test your App or Macro
Reorder interface elements
Customize the App or Macro controls (like changing the icon for a Macro)
You can convert a workflow to an Analytic App file type (.yxwz) in the Workflow Configuration window:
When a workflow is saved as an App (or Macro), the anchors of tools in the workflow change to lightning-bolt icons. Only Interface Tools can connect to these anchors. This anchor indicates that there are interface elements and actions available to update a workflow tool.
Once you’ve made your App, there are several ways to run it. Double-clicking on the file will open just the App GUI. If you already have the App open in Alteryx Designer, you can click the wand icon to the left of the Run button to run it as an Analytic App.
If you want the results of one workflow to be used in a second workflow, then you can chain two Apps together. One way this could be helpful is if you want to dynamically limit selection options in an App based on what the user has already selected. The Interface Designer allows you to indicate which App to run after the selected App finishes:
You can take chained Apps one step further by using the first workflow in the sequence to modify the XML of the second workflow—read all about it in this blog.
You can convert a workflow to a Macro file type (.yxmc) in the Workflow Configuration window. You will see there are four options for Macro types—we will dive into the main three in this section.
Once you have created a Macro (or download one from the Gallery), you can bring it into a workflow by right-clicking on the canvas and then navigating to Insert > Macro. If the Macro you would like to insert is not open in Designer, you can click Browse and select a Macro from anywhere on your computer.
There was a blog series titled “Macro May-nia" on Community in which authors used different metaphors to explain the Macro types and terminology. Add some fun to your learning by reviewing the articles:
The simplest type of Macro is a Standard Macro. You can think of this as a workflow within a workflow. If you find yourself using the same combination of tools for processes repeatedly, you might have an opportunity to automate some of your work by creating a Standard Macro.
A key feature of (most) Standard Macros is that they have a Macro Input and Macro Output tool. These tools are the entry and exit points of your Macro, respectively. They allow you to bring data from your workflow into the Macro process and then output the results back into the workflow.
Using interface tools in Standard Macros can be a nice way to make changes to python code without a user needing to edit the code itself. Learn more about this use case in this blog on Python Macros.
A Standard Macro using the Python tool
Batch Macros run multiple times in a workflow and create an output after each run. They run once for each record or a selected group of records in data. A key differentiator between Standard Macros and Batch Macros is that Batch Macros require a Control Parameter tool as an input. The Control Parameter tool determines how the batches of records are created—it will take the list of values and run the Batch Macro logic once per value.
When inserted into a workflow, Batch Macros have a distinct icon for the input—an upside-down question mark:
An Iterative Macro will run through every record and then loop the records back through the workflow, repeating the entire process as many times as is specified or until a condition is met.
Once you have Iterative Macro selected as your workflow type, you will notice that the properties in the Interface Designer change. The iteration input is the Macro input in the workflow that contains the records to use for the iterative process. The iteration output is the output in the workflow that contains the records that will loop back through the iterative process. You can also set the maximum number of iterations and what to do once that number is hit.
It’s important to pay attention to your data structure when working on an Iterative Macro. The better you understand your data and how the Macro’s process will change it, the easier it will be to anticipate what your data should look like after multiple iterations of the logic.
Finally, there are a few blogs with Iterative Macro examples that you can read about. This blog contains a helpful step-by-step walkthrough of the process of creating an Iterative Macro. And this blog includes an Iterative Macro nested in a Standard Macro for building hierarchies.
Sometimes it’s hard to uncover the root cause of issues. Luckily, when designing an Analytic App or Macro workflow, you can run a test that simulates the user experience. This is a handy feature that aids in troubleshooting. When the test is run, a Debug workflow is created and opens in a new tab in the current Alteryx session. Learn more about this feature in the help documentation. This blog on debug mode is also a helpful guide for getting to the bottom of errors.
Here are some discussion threads that answer common questions about debugging/troubleshooting Macros: