Create Variable Action

Description

Creates an Automated Workflow variable, which can be used to store dynamic values for use in any step.

Variables are used as storage mechanism to store data while a Workflow is running. For more information see Variables. Once a variable is created, its contents can be displayed at runtime by placing the variable name in percent signs (e.g. %myvarname% will automatically be converted it its contents at runtime).

Declaration

<AMVARIABLE NAME="text" READONLY="yes/no" PRIVATE="yes/no" ISPARAMETER="yes/no" DESCRIPTION="text">text</AMVARIABLE>

Example

<AMVARIABLE NAME="MYVARIABLE">Sets the variable to this value</AMVARIABLE>

General Tab Parameters

Variable Name: Specifies the name of the variable to create. It is important that this value is unique, descriptive and does not conflict with any BASIC scripting keywords (examples of common conflicts include: date, day, week, etc). Click the Expression Builder icon to build and insert an expression or variable.

Text, Required
MARKUP: NAME="thecurrentdate"

Initial value: Specifies the value that the variable should be set to initially. As with all parameters, this value may be literal or an expression (if surrounded by percent % signs).

Text, Optional - Default (blank)
MARKUP: ...>The current date is %Format(Now())%</AMVARIABLE>

Description: An optional text description that describes the purpose of the variable, this information will be displayed at design time in the Debug | Variables information window.

Text, optional default (none)
MARKUP: DESCRIPTION="This variable holds the date"

Advanced Tab Parameters

Variable type: Causes the variable to assume a specific type.

  • Auto: Variable will auto-detect whether it contains a number or text. Variable will adapt to the proper type when possible depending on the operation being performed.

  • Text: Variable will always be treated as text regardless of its contents. If an operation is attempted that is only valid for numbers, an error will be thrown.

  • Number: Variable will always be treated as a number regardless of its contents. If an operation is attempted that is only valid for numbers, an error will be thrown.

Text, Required
MARKUP: TYPE="number"

Variable is read-only: Specifies that the variable is not able to be set to a value other than that specified in the Initial Value parameter.  Selecting this option is equivalent to creating a Workflow specific constant.

Yes/No, Optional - Default no
MARKUP: READONLY="yes"

Variable is private: Specifies that the variable is only available to the current Workflow and not to sub Workflows started with the Start Workflow action. If this value is left unchecked (default) the specified variable will be available to sub Workflows.

Yes/No, Optional - Default no
MARKUP: PRIVATE="yes"

Treat as parameter: Specifies that the variable will only be created if it does not already exist. This is particularly useful when a Workflow may have parameters passed to it at runtime (that is, variables of the same name will be created automatically) but a default value should be assumed when debugging and parameters are not present.

Yes/No, Required
MARKUP: ISPARAMETER="YES"

Notes

All variables must be created before they can be used. This is done using the Create Variable <AMVARIABLE> action. Once created, variables can be set using the Set Variable <AMSET> action, or by certain actions that support populating variables. To get data out of the variables, in any action parameter, simply surround the variable name with percentage % signs (e.g. %varname%). Remember not to use percentage signs when specifying the name of a variable to populate, percentage signs are only needed to get data out.

See Also

Set Variable