Variables (Magic xpi 3.x)
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:
You can access project variables by selecting the Project menu and clicking Variables. This opens the Variables for Flow dialog box. From here, you can define flow variables, context variables, business process variables, and global variables.
You can access the variables that are related to a specific flow by selecting the flow, selecting the Flow menu, and clicking Variables. You can also right-click on the flow in the Navigation pane, or you can press Ctrl+L. This opens the Variables for Flow dialog box.
These 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.
When you click on one of the tabs, you can press Ctrl+F, open the Edit menu and select Find Name, or right-click and select Find to open the Find dialog box. 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.
You can also right-click and select Cross Reference to find all uses in Magic xpi of the selected variable.
Variables contain the following properties:
|
|
Name
|
The variable name. This name is not case sensitive.
The variable name cannot contain more than one dot (.), any of the following characters: # - & \ / < > { } [ ] ( ) , ; " % or a space.
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 Cross Reference utility to check where the variable is used. (Cross-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
-
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.)
-
Date (see Updating a Date Type Variable)
-
Time
-
BLOB
-
Logical
Note:
|
-
If you define UDS models in the UDS Repository, they will be added to the list of the flow variable types (in the Variable repository's Type column).
-
If you change a variable's type, it will be changed automatically only in the Flow Data Service 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:
The expression is computed for each variable, one after the other, using existing expression calculation rules.
Notes:
|
If you use the Expression Editor to define a default value that includes variables, you can only use global or environment variables.
|
|
|
Notes:
|
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.
|
|