Variables (Magic xpi 4.5)
Magic xpi lets you define variables that can be used in projects and in flows. Variables can be any type of data that describes something that changes depending on certain conditions. Customer_Name can be a variable because the name of the customer will change depending on the condition. Variables are used to create flow logic.
Magic xpi supports the following variable types:
-
Flow Variables: Accessed by double-clicking Flow Variables, under the relevant flow in the Solution Explorer. Alternatively, you can select the Project menu and click Variables when the flow area is displayed, or you can park on the relevant flow and press Ctrl+L.
-
Context Variables: Accessed by double-clicking Context Variables, under the Repositories folder in the Solution Explorer.
-
Business Process Variables: Accessed by double-clicking BP Variables, under the relevant business process in the Solution Explorer.
-
Global Variables: Accessed by double-clicking Global Variables, under the Repositories folder in the Solution Explorer.
The various variable repositories are storage areas that let the flow components save and retrieve data items. They can also be used to manage flow logic and to move data from one component to another.
In each of the variable repositories, you can open the Find Reference Results dialog box by:
-
Pressing Ctrl+F while parked in the repository.
-
Selecting the Edit menu while parked in the repository and clicking Find, followed by Find Reference.
-
Right-clicking while parked in the repository and selecting Find Reference.
This enables you to find all uses in Magic xpi of the selected variable. You can use this functionality to find the first variable that contains the search string. The search will look for the string in the Name and Description columns only.
Note:
|
Make sure that variables are not in use before you attempt to delete them. You can do this by running the Find Reference utility.
|
Variables contain the following properties:
|
|
Name
|
The variable name. This name is not case sensitive.
The variable name cannot contain any of the following characters: [space] ~ ` ! @ # , % ^ & * - = + ( ) { } [ ] | " ? / \ < > ; or more than one dot (.).
For runtime, variable names must be in English or the language of your runtime environment.
Note:
|
The theoretical maximum length of a variable name is 30 characters. However, since Magic xpi adds a prefix to each variable name, such as F., C., or G., the actual maximum length that a variable name can be is 28 characters.
|
For all variable types, when changing the name, you should first use the Find Reference utility to check where the variable is used. (Find Reference for environment variables is supported only if that variable is used in the EnvVal function.) This operation will load the flows to memory and enable a global name change.
If you rename a variable, the variable name will automatically change in the following places:
-
An Expression Editor that was previously opened and contains an expression with the variable.
-
Any step properties that are opened and contain the variable, or an expression using the variable.
-
Any condition on a step that includes the variable.
-
A Data Mapper with variables in the Source or Destination.
If you rename a variable, the variable name will not automatically change in the following places:
-
UDS
-
ODS
-
Conversion tables
|
Description
|
A short description of the variable.
|
Type
|
The data type. Select one of the following from the drop-down list:
-
Alpha
-
BLOB
-
Date (see Updating a Date Type Variable)
-
Logical
-
Numeric (Numeric variables can be an integer or a decimal number containing up to 17 digits. A decimal point is considered to be a digit. For a negative number, N should be added as a prefix to the number.)
-
Time
Note:
|
-
If you define UDS models in the UDS Repository, they will be added to the list of the flow variable types (in the Flow Variables repository's Type column).
-
If you change a variable's type, it will be changed automatically only in the Flow Data utility and in the Data Mapper's connections. If you use or select the changed variable in any other places, the Checker will return a mismatch error.
|
Each data type has a unique key (name) that allows any component to access the information in the storage area. Access to the data types is made possible by using a user-defined string.
If you change the data type, the variable name is not updated in expressions currently using it, unless you load the flow or check out the flow.
|
Length
|
The maximum length of the variable.
|
Default Value
|
The default value for the variable, if there is one. You can either:
The expression is computed for each variable, one after the other, using existing expression calculation rules.
Note:
|
-
If you use the Expression Editor to define a default value that includes variables, you can only use global or environment variables.
-
When using hard-coded strings as the default value, only English and the system language are supported (Since version: 4.5).
|
|
Note:
|
To help you to distinguish between global and local variables in expressions, Magic xpi gives automatic prefixes to variables. These prefixes are:
Because these prefixes are added automatically, you only need to type the variable name. However, if you want to edit an expression, you should type the relevant prefix.
|