Accelerate Workflow Development with Alteryx User Constants

In this post, I am going to show you how  use Alteryx user constants to speed up development and troubleshooting in your workflows.  I learned how to apply user constants from the Altery Virtual Solution Center, which is where you can go to get one on one help with your workflows.  This is one of the best pro tips I’ve ever learned about Alteryx. You don’t want to miss this.

Blog or Video

If you prefer watching to reading, check out all of the blog content in the video below. You can watch it embedded or pull it up on YouTube. If you like the content, please subscribe to my YouTube channel. There are only a handful of videos up now, but all future posts will contain video content.

What is an Alteryx User Constant?

From the Alteryx Documentation: Constants are global variables for a workflow that are defined on the Workflow tab in the Workflow Configuration window. Constants make it possible to change a value in a single location and have that change apply to the rest of the workflow. But what does that really mean and how are they useful?

To find or create user constants, click on the whitespace of your workflow and then go to the Workflow tab. Click on the plus sign to create a user constant. Name the constant and give it a value. In the screenshot below, I have created two user constants — Well Name and Filter Status. Now, let me show you how I use them.

Accelerating Development with Alteryx User Constants

My Use Case

This workflow imports completions data for thousands of oil and gas wells. Sometimes, all I want to do is push data for one well through the entire thing. This would make it run faster and be easier to troubleshoot.

Before user constants, I did this with Filter tools. But, those have to be added and removed, which is a huge pain. Users constants accomplish the same task but you can leave the Filter in place. Let’s look at my constants again.

Now, here is the logic I use in a Filter tool placed right after each of my Input tools. I reference the constant like a column of data, with square brackets. “[User].” denotes it as a user constant.

If the user constant “Filter Status” is set to “Off”, nothing happens. All the data flows through the tool. If the user constant is set to “On”, the logic also requires that the Well Name in the constant equal the name in the “well completion name” field. Only the matching data will flow thru. If you haven’t watched the video, check it out to see this in practice. I also have a few other uses for user constants.

Blocking Email Notifications with User Constants

They are also very handy for keeping email notifications on hold while developing a workflow. Because no data makes it through the filter, Alteryx does not send the email. In the workflow shown below, I created a user constant called “Status” and set it to “Not Ready”. Then, I placed a Filter before my Email tool. Alteryx sends the email when the Status changes to Ready. Check out the YouTube video to see it in action.

Caveats

I did make a mistake with user constants when I tried to use the constant just before an Output tool writing to SQL. I expected that no output would be written to SQL and my table would remain intact. In actuality, the Output tool dropped my table and wrote zero records to it. I definitely didn’t want the table dropped, so just make sure to test your application of Alteryx user constants.

Content Created With

Alteryx 2019.4.8

Other Alteryx Posts

2 thoughts on “Accelerate Workflow Development with Alteryx User Constants”

  1. Pingback: Speed Up Query Time with Alteryx Detour Tool » The Analytics Corner

  2. Pingback: Manage Analytics Assets with Microsoft Azure DevOps - Part 1 » The Analytics Corner

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.