âShow Table of Contents
A Macro Workflow is a workflow that has the flexibility to be run as a single tool within another workflow. Macros save with an *.yxmc extension.
Macros are built by using Interface Tools along with the Interface Designer.
There are three types of Macros set from Workflow Properties:
- Batch: A Batch Macro is a special kind of macro that is designed to be run repeatedly in the context of a workflow. It takes a special input called a Control Parameter that maps fields to questions for re-configuring 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 two 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.
- Iterative: An Iterative Macro will run through every record and loop the records back through the workflow as many times as is specified, or until a condition is met.
- Location Optimizer: The Location Optimizer Macro is an iterative macro that determines the best score for each demand location and then assigns the best correlated Supply locations according to those scores. You are able specify how many locations you would like to add to the Network, specify the Optimization Level to Fast, Balanced, Accurate or Custom and then have it randomly seed or specifically seed the iterations.
Using Macros in Workflows
Macro Repository User Setting: Users can create a Macro repository where Alteryx will look in the specified directories for Macros and display them in the Tool Palette for building workflows. Users can specify the default directory to save Macros to, indicated by *Default. Configurable options can be set from the User Settings, Macros tab.
When a Macro is used as a tool in a workflow, it may display with the Macro Indicator, . This is a display preference that can be turned on in User
Settings. Go to Options > User Settings > Edit User Settings >Canvas > Display macro indicators on tools.
To insert a Macro into a workflow that is not in the Tool Palette, right-click on the workflow canvas and select Insert > Macro and browse to the location of the *.yxmc file.
If you are using a Macro from a custom directory, you will need to keep in mind that the Macro will need to be included with the workflow. Should you need to share the workflow, ensure the Macro is packaged with it and/or the path to the Macro is relative to the workflow and other workflow dependencies. This can all be handled easily through Workflow Dependencies and the Workflow Packager.
- Installed Macros:
- This is either a macro in the Program Files\Alteryx\version\bin\RuntimeData\Macros directory or a macro in one of the AddOnData\Macros directories - either installed there or placed there.
- This macro will be stored as a relative path only.
- It will NOT be available in Workflow Dependencies.
- It will be available in the workflow packager - but default to unselected.
- Macro Repository:
- If adding a Macro from the right-click Insert menu:
- Alteryx will try to make a relative path when you first add it. After the initial add, it will remember it how it is in the workflow. If you make it absolute in Workflow Dependencies, it will stay that way.
- The Macro will be available in Workflow Dependencies and work like any other file. Workflow Dependencies is the only way to edit the path.
- In the Workflow Packager - it will default to selected.
- When resolving a Macro with a relative path, it is searched for in the following order:
- Within the folder that the workflow contains.
- The RuntimeData\Macros folder.
- The Macro Repository. This includes any AddOnData\Macros directories that were created from a dataset installation.