Alteryx Server Knowledge Base

Definitive answers from Server experts.

'Tis the season to be spooky! Read our new blog, How Spooky is Your City? Mapping and Predicting Scary Stuff. In it, @SusanCS provides a fun glimpse into using data to figure out the creepy quotient of where you live!

Sharing Macros in Alteryx Designer and Server

Alteryx
Alteryx
Created
Introduction
 
Does your organization have macros that users have developed to perform common and/or repeatable tasks within Alteryx? Does your organization struggle with how best to share those macros with the Alteryx Designer users and Alteryx Workflows/Apps which have been published to the Alteryx Server? Would you like to streamline the process of updating macros and utilize them through your Alteryx Workflows?  Great, now let’s take a look at how we can easily achieve this within your Alteryx environment(s).

 

As is common with many organizations, users within the organization have likely developed macros which perform various processes in Alteryx. These macros contain everything from simple to advanced data cleansing operations, core business logic, data manipulation tasks and much more. Once a user has developed a macro, we want to make it easy for them to share that with the rest of their Alteryx community.

 

When it comes to using macros in Alteryx Workflows and Analytic Applications published to Alteryx Server, many organizations have questions about how to deploy those Workflows that utilize these macros. More importantly, when a change is made, how do they propagate the latest version of the macro to all of the published workflows?

 

In this article, we will discuss the best practices around sharing macros. Using the methods outlined here, users will be able to make changes to Alteryx macros that are seamlessly propagated to other Alteryx Designer users, as well as Alteryx Workflows and Analytic Applications that have been published to the Alteryx Server.

 

What are macros?

 

Before we dive in to sharing macros, let’s define exactly what a macro is. Macros are a series of Alteryx tools built into a single workflow, that are bundled into a single tool that can be easily inserted into another workflow to perform common, repeatable tasks. Think about it as if you were taking an entire workflow and zipping it up into one Alteryx Designer icon, which you can then put into any other workflow.  A perfect example of this would be to create a standard macro out of an analytic process you have to repeatedly create on a regular basis.   Having this process in a macro form, allows you to then re-use that entire process in any number of other workflows without having to recreate the analytic process (or workflow) each time. This not only helps save time, but it also makes the entire process easily repeatable and protects you from forgetting any steps in that process. One key benefit to macros is, down the road, if there is a change to be made to that whole process, you only need to make that change in one workflow (macro), rather than chase down every instance that process was replicated.

 

Macros are identified by a .yxmc file extension.  There are four main types of macros with Alteryx: Standard Macros, Batch Macros, Iterative Macros, and Location Optimizer Macros.

 

Standard Macros

 

These macros, as mentioned above, are designed to package a process in a workflow as a tool that can be inserted into a workflow.

 

Batch Macros

 

These macros run multiple times in a single workflow, creating an output after each run. The macro runs once for each record, or selected group of records, in the data. This type of macro requires a Control Parameter tool to be used as an input. For additional information, see Batch Macros.

 

Iterative Macros

 

These macros run in the workflow the number of times set in the configuration, or run continuously until a specified condition is met. For additional information, see Iterative Macros.

 

Location Optimizer Macros

 

These macros are an iterative macro that can be used in network analysis to identify an optimal location or locations. For additional information, see Location Optimizer Macros.

 
Sharing Macros

 

Macros can be shared with users of the Alteryx Designer and Alteryx Server using a network file share. Permissions on who has access to the macros are controlled by permissions you define on the share. You can assign share permissions to users, groups of users, and computers to expose macros to Alteryx Workflows which have been published to the Alteryx Server.

 

Once you have placed the macro in a network share, you can add a macro repository in Alteryx Designer. After adding a macro repository in Alteryx Designer, the macros will appear in the tool palette, and can be searched by using the search toolbar in Alteryx Designer.

 
Creating a Network Share

 

NOTE: The following is an example of how to create a network file share. It is not intended to be used in production environments.

 

Depending upon the permissions defined on your network, it may be necessary to work with your IT department to have a network share created or permissions granted. Assuming you have the correct permissions to create a network share, proceed as follows to create a network share for macros:

  1. Open the Computer Management console on the file server
  2. Expand the Shared Folders section
    Step 2 Network Share.png
  3. Right-click on Shares and select “New Share…”
    Step 3 Network Share.png
  4. Follow the prompts in the “Create a Shared Folder Wizard” to create a network share

NOTE: When creating the network share, you will be prompted to set shared folder permissions. Permissions allow you to control the level of access users, groups of users, and computers have on the network share.

 
Permission Considerations
 
Within an Alteryx Server environment, there are various ways workflows can be run. By default, all workflows will be run by a Local System account. However, you can configure Alteryx Server to run all workflows as a specific user in the Alteryx System Settings -> Worker -> Run As settings or you can require users to enter their domain credentials to run workflows. Depending upon the configuration of your Alteryx Server environment, this can dictate how permissions need to be assigned to the network share.

 

Example 1: If workflows are running under the default system account, in addition to assigning permissions to the share for users of the Alteryx Designer, you will need to assign computer permissions to the share for each server in your Alteryx Server environment.

 

Example 2: If workflows are running under a service account using the Alteryx System Settings -> Worker -> Run As settings, in addition to assigning permissions to the share for users of the Alteryx Designer, you will need to grant the service account access to the network share.

 

Example 3: If you require users to enter their credentials to run a workflow in your Alteryx Server environment, in addition to assigning permissions to the share for users of the Alteryx Designer, each user with permission to execute the workflow will need permission to the network share.

 
User and Group Permissions on Network Shares

 

NOTE: The following is an example of how to assign user and group permissions on a network share. It is not intended to be used in production environments.

 

To assign User and Group permissions, ensure the Users and Groups object types is selected in the “Select Users, Computers, Service Accounts, or Groups” dialog window. If either is not shown in the object types, click the Object Types button and select the Users and Groups object types.

1 - Users-Groups.png

2 - Users-Groups.png

 
Computer Permissions on Network Shares

 

NOTE: The following is an example of how to assign computer permissions on a network share. It is not intended to be used in production environments.

 

To assign computer permissions, ensure the Computers object types is selected in the “Select Users, Computers, Service Accounts, or Groups” dialog window. If Computers is not shown in the object types, click the Object Types button and select the Computers object types.

 

1 - Computer Permissions.png

 

Shared Macros in Alteryx Designer

 

Now that you have created a network share for your macros, and assigned user/group/computer permissions, it is time to create a macro repository in Alteryx. Once you have added a macro repository to your Alteryx Designer, the macros will appear in the tool palette and be searchable using the search toolbar. To create a macro repository, proceed as follows:

  1. Open Alteryx Designer
  2. Go to OptionsUser Settings > Edit User Settings and click on the Macros tab
    Step 2 - Designer.png
  3. Click plus icon.png to add a macro repository
    Step 3 - Designer.png
  4. In Category Name, type a name. Macros will appear in the tool palette under the Category Name defined here. The default name is Macros
    Step 4 - Designer.png
  5. Click ellipses.png to browse to the location where you save macros on your computer or a network or paste the file path to the network share containing the macros
    Step 5 - Designer.png
  6. Click the OK button on the “Add Search Path for Macros” dialog window
  7. Click the OK button on the User Settings dialog window


Once you have completed the steps above, the macros will appear in the Alteryx Designer tool palette under the category name specified in step 4.

 

NOTE: Sub-folders in a search path cannot be added individually if their parent folder already exists in the Macros repository. If you want sub-folders to display in different tool categories, you will need to remove the parent folder and add each sub-folder individually.

 

Shared Macros in Alteryx Server

 

To make the macros available to workflows published to your Alteryx Server environment, you will need to create the macro repositories on your Alteryx Server. To ensure the path to macros in workflows match between the Alteryx Designers systems and the Alteryx Server, the macro repositories will need to match those created on your Alteryx Designer users’ systems. To create a macro repository, proceed as follows:

  1. Open Alteryx Designer as an Administrator on your Alteryx Server
  2. Go to OptionsUser Settings > Edit User Settings and click on the Macros tab
    Step 2 - Designer.png
  3. Click plus icon.png to add a macro repository
    Step 3 - Designer.png
  4. In Category Name, type a name. Macros will appear in the tool palette under the Category Name defined here. The default name is Macros
    Step 4 - Designer.png
  5. Click ellipses.png to browse to the location where you save macros on your computer or a network or paste the file path to the network share containing the macros
    Step 5 - Server.png
  6. Click the OK button on the “Add Search Path for Macros” dialog window
  7. Click the OK button on the User Settings dialog window


Once you have completed the steps above, the macros will appear in the Alteryx Designer Tool Palette under the category name specified in step 4.

 

NOTE: In a multi-node server deployment, you will need to create the macro repositories on each node. After creating a macro repository on one server, you can copy and paste the newly created .ini config file (located at C:\ProgramData\Alteryx\DataProducts\AddOnData\Macros) to the same path on each server in your Alteryx Server environment.

 

Frequently Asked Questions

 

Q. When I publish a Workflow to my Alteryx Server environment, do I need to do anything else?

A. No. When you create a macro repository, Alteryx Designer sees macros contained within the directory as a “native macro” and references the macro using relative paths. When you publish the Workflow to Alteryx Server, the macro will continue to be referenced using a relative path based off the repository path defined in your Alteryx Server environment. You can verify that the macro is not being packaged with the workflow by checking the Workflow Options -> Manage Workflow Assets in the Save As dialog window.

 

Q. I’ve made a change to one of my macros. How do I deploy the latest macro to all the published Workflows in my Alteryx Server environment?

A. When you save the macro to the network share, it will automatically be updated for every workflow that references the macro in the macro repository you created.

 

Q. I have multiple environments, dev, staging, and production. I would like to ensure changes to macros are properly vetted before being released to production. Will this work for my needs?

A. Yes! For this to work, you can create a file share for each environment and assign the appropriate permissions to each environments file share. When adding the macro repositories to each environment, you can supply the environment specific macro repository path. When users make any changes to macros, they should save the new version to the dev file share. You can then test the updates to validate the changes before moving the updated macro to the staging and then production file shares.

 

NOTE: To ensure a seamless transition between the Alteryx Server environments, it is important to ensure the folder/file structure matches in each of the environment-specific file shares.

 

Q. Can I use a mapped network drive to share my organizations macros with Alteryx Designer users and Alteryx Server?

A. As mapped network drives are mapped on a per user basis and do not appear to batch processes, using a mapped network drive will not work for sharing macros with Alteryx Server. It will, however, work if you are only sharing macros between Alteryx Designer users within your organization.

Comments
Alteryx
Alteryx

Great Article.

 

What are some best practice for sharing macros this way when the Server requires a UNC path to access files in the shared folder?

 

Is there a way to publish workflows with macros to the gallery without having to manage the dependencies before publishing (converting to UNC path/packaging macros as assets)?

 

Here is a community post that might provide some more context:

Alteryx Community | System cannot find the path specified

 

Thanks,

Luke

 

Alteryx Partner

Hi @ZacharyH :

Thank you for the article and how-to. It has been very helpful.

I have a question about the UI in Designer, though. 
I have followed your directions to a T, and I still cannot get my development directories to show up in the tool palette.

I'm developing custom macros for my team, and I have a custom macro directory for each tool. To have an example:

  • //shared location/Custom Validation Macro/Dev
  • //shared location/Custom Macros/Production

I've linked up both of these to Designer (I'm using version 2019.4.6.21113) via user settings>Macros

 

When I'm done developing a macro, I will often remove it from this list to de-clutter my palette.

Today, I am developing the Validation macro.

thedr9wningman_0-1589908749358.png

I have this set up. Within the metadata in the macro itself, I created a custom tool palette so I can find this more easily:

thedr9wningman_1-1589908880981.png

And when I try to add the tools into the toolbar, I can't find this macro anywhere, whether I have a custom tool palette or not. I try to refresh the tools by hiding and unhiding deprecated tools, but I just can't find the bloody tools!

thedr9wningman_2-1589909013349.png

 


What am I doing wrong?!?! I've even restarted Alteryx.

 

 

Alteryx Partner

Although I have changed the name of this tool, I have found that there is an ability to choose the version of the macro, and I am able to use the existing macro in a workflow and just change the version. I think this is because the root tool name is the same.