-
Notifications
You must be signed in to change notification settings - Fork 6
Variables...
Version 1.4 of Abacus library sees the addition of a variable concept for expressions within Alteryx. This post summarises how they work and gives you some examples at the bottom of how you can use them within your workflow to achieve some impressive results.
The variable system is exposed to Alteryx as a set functions which can be used anywhere an expression is used. They are divided into three classes of variables:
- Text: Holding a string value
- Number: Holding a numerical value
- List: Holding a list of numerical values. Please note you cannot put a null value into lists currently.
All variables are stored by a string key value and accessed using this. They are implemented as dictionaries - this allows you to also dynamically evaluate the key as part of the expressions.
A variable is global for the run of a workflow however due to the way iterative or batch macros are executed the scope may not cover these (this is an area I haven't tested so any feedback welcome!).
The Text and Number functions act in the same way. There are four functions to manipulate these kinds of variables (two for each type):
- VarTextExists and VarNumExists: these check for the existence of a variable and return true or false
- VarText and VarNum: these get or set the value of variables
For example:
-
VarTextExist("Demo")
will return false if "Demo" has not been set.