Using Global Variable
Global variables are used for mapping source elements, mapping functions or constants to target elements. They are declared and used globally for all target elements.
To use a global variable in a mapping activity, you need to map it to a target element. This will successfully execute the global variable when you execute the mapping activity in the process flow.
A global variable differs from a context variable, in the respect that it is available only within the selected mapping activity. Context variables are available in the process designer too.
Declare Global Variable
Steps to declare a Global Variable
- Ensure that the source and destination layout are loaded and all their elements are listed under their respective nodes.
- Click the Add Parameters icon and select Variables to display Create New Variable tab.
Select Global Variables to enter the details of global variables.
- Enter the name of the global variable you want to create (e.g. emp_age). Press the Tab key. This takes the control to the Global Variable Value field.
- Enter the value of the global variable in the Global Variable Value field. You can enter the value of the global variable using one of the listed methods:
- Click required source element
- Select the required Mapping function
- Type the required value manually
Select a Custom Method
To select a Custom Method as the value of a global variable, click the Custom Method in the Parameters Panel. To learn how to declare a Custom Method, refer to section Using Custom Method.Enter comments for the global variable in the Comment field. For example, if the global variable value contains complex XSLT logic, you can enter its description in this field.
Click Save button to save the global variable. This global variable is added to the list of existing variables in the Global field. It is also displayed under Global Variables in the Parameters Panel.
To remove a global variable, select the global variable and click Remove.
Managing a Global Variable from the Parameters Panel
Once the global variable is added to the Parameters Panel, you can edit it or delete it anytime from this Panel itself.
Steps to manage a Global Variable from the Parameters Panel
Select the global variable that you want to edit or delete and click icon to display the menu.
- Select Edit to edit the variable. This displays the selected global variable in Edit mode. You can edit the value of the global variable in the Global Variable Value field. You can also edit the name of the global variable.
Alternately, select Remove to delete the selected variable. This displays a confirmation screen for the delete operation.
- Click Yes to delete the selected variable.
Map Global Variable to Target Element
Once you have created a global variable, you can map it to a target element.