The use of constants in an Alteryx workflow has the potential to save the user a great amount of time. Especially if a workflow is large and has a lot of variables of the same value that need to be changed –  perhaps if the workflow is recycled or is for testing.

Here’s a quick step-by-step guide to how to set these and apply them:

  1. Click anywhere in workflow blank space/ canvas
  2. Go to Workflow configuration
  3. Click Workflow tab
  4. Under ‘constants:’
  5. Click ‘+’ symbol
  6. ‘user’ line will appear
  7. Give it a name
  8. Then a value
  9. The tick box if ticked will apply data type as numerical, if unticked it will be a string

An example setup can be seen below:

Here, circled in orange, the new user constant ‘NEWCONSTANT’ with a value of 0.12 has been created.

Now the newly created constant will appear within the constants category of a tool that can utilise formulas, such as the filter or formula tools:

Here, circled in orange, is the ‘User.NEWCONSTANT’ constant now available to use in formulas giving the numerical value of 0.12.

When could this be useful?

If building and optimising a predictive model, tweaking values is sometimes needed to yield a sufficiently large target sample. You may have filters and formulas following your tested and chosen model to categorise and single out the target of your analysis. For example, in the workflow below:

A constant has been applied 3 times to act as a threshold for qualifying into the target group. Changing the value for these is now much quicker when testing this.

A final point to note – In some cases, Alteryx will struggle to register the constant as a number type value and will consequently produce an error if used in a numerical type calculation. To Rectify this ‘ToNumber’ can be added before the constant name.

e.g. – ToNumber([User.NEWCONSTANT])