Specifying the variable element and its attributes
This topic describes the element that defines a variable.
A variable is defined on the variable (<variable>) element.
The elements and attributes that are used to define variables are listed in Table 12 and Table 13.
- Name of the variable. The name is required, and must be a string consisting of letters
(uppercase or lowercase), numeric digits, the hyphen, and the underscore character. This value must
begin with a letter.
The combination of name and scope must be unique within the workflow.
- Scope of the variable, as follows:
- instance
- Variable is used only within the workflow in which it is defined. If multiple workflows are created from the same workflow definition file, each has its own set of instance scoped variables.
- global
- Variable can be referenced by any workflow that is imported into the Workflows task. Global variables are shared across all workflows, even workflows that are created from different workflow definitions. As an example, you might use a global variable to refer to a product-specific constant across a number of workflows that are associated with the product.
The scope is required. The default is instance.
The combination of name and scope must be unique within the workflow.
You cannot use the same name for both an instance variable and a global variable in the same workflow definition.
Use global variables with caution to avoid possible naming conflicts across unrelated workflows. Consider your naming conventions carefully and avoid using unspecific variable names. Consider qualifying your variables, for example, with the 3-character prefix associated with your software product, or a similarly unique identifier.
Be aware that variables are case-sensitive. For example, "Variable1" is not the same as "variable1."
- Specifies whether the variable is intended for public or private use. This attribute is intended for the workflow author’s use. The visibility setting does not affect how the variable is processed by the Workflows task. This attribute is optional; the default is private.
Example of a variable definition
<variable name="variable_test" scope="instance">
<label>Variable 4</label>
<abstract>Abstract for Variable 4.</abstract>
<description>Description for Variable 4.</description>
<category>variables</category>
<string/>
</variable>