This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
You're working on your gazillionth Formula tool and "Jeff" from Quality Assurance sends you an email that the margin of error for your process has been restandardized. It's not 0.122 anymore but 0.121. Then the horrible reality sets in - you're going to have to go back through all of your formulas and update that one.. stupid.. little.. number.
You vow that you'll never again let smug "Jeff" ruin your night with his nitpicky tolerance standards, so you open up your browser, load up your home page (the Alteryx Community page duh), and find exactly what you've been looking for: a Knowledge Base article about document constants.
So what's a constant? According to the Alteryx Help pages: "Document Constants are global variables for a workflow. Constants make it possible to change a value in a single location and have that change propagate to the rest of the workflow."
You can find constants in your Workflow Properties tab (Click on the canvas and go to Workflow in the Configuration Window).
The "Is Numeric" checkbox on the far right will make the value numeric rather than a string.
Temp File Path: The directory where the engine will write temporary files.
Version: The version number of Alteryx engine installed on the machine.
Workflow Directory: The directory of the current workflow. If no workflow is open, the value will be the Alteryx installation directory.
GuiInteraction: A Boolean value indicating whether or not a workflow is being run from the GUI. When a workflow is run from the Alteryx Designer or Analytic App interface, the returned value will be True or 1. When a workflow is run from command line, the returned value is false, or 0.
IterationNumber: An integer that corresponds to the number of times a macro has run, starting at 0.
Clicking on the symbol will allow you to add User Constants. In the above screenshot, I added a "Favorite Number" User Constant. These can be strings or numerics, and will stick with the workflow if you send it, schedule it, or upload it to a Gallery.
If you're making an app or macro, many of your Interface Tools will show up as Question Constants. The name of this constant will correspond to the name of the tool in the Annotation area of the Tool Properties.
Engine and User constants will populate under the Constants menu in the Variables. They will come in as either numeric or string based on whether that Is Numeric checkbox is checked off.
Question constants will not show up in this menu, and cannot be typed in [...] notation like the other variables.
Any constant (Question included) can be called upon in any configuration option using a reference shortcut. This may not always work exactly like you think it will, so use this method with caution.
Generally, in any configuration you can type into, you can bring in a constant by using the notation %Type.ConstantName%. For example, in our Formula tool, we could refer to that Question constant in our Expression Editor.
Note we still had to place it within quotes, because these do not come in with our constant value.
Using the reference shortcut, we can pass along data without even connecting up the Interface tool to the formula.
Above we have a macro with the text box named "Constant", and below is the result when run in another workflow.
Check out the attached example to see it all in action! (compiled in version 10.1)