Using Local Variable
Local variables are used for mapping source elements, mapping functions or constants to a specific target element. They are declared and used only for the specific target element or attribute for which they are declared.
To use a local variable in a mapping activity, you need to map it to the specific target element or attribute. This will successfully execute the local variable when you execute the specific mapping activity in the process flow.
Declare Local Variable
Steps to declare a Local 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 Local Variables to enter the details of local variables.
- Enter the name of the local variable you want to create (e.g. varQuery). Press the Tab key. This takes the control to the Local Variable Value field.
- Enter the value of the local variable in the Local Variable Value field. You can enter the value of the local 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 local variable in the Comment field. For example, if the local variable value contains complex XSLT logic, you can enter its description in this field.
Click Save button to save the local variable. This local variable is added to the list of existing variables in the Local field.
- Once the local variable is saved, it is categorized as Current Variable or Ancestor Variable in the Parameters Panel. If it is created for a child node, then it is saved as a Current Variable. If it is created for a parent’s parent node, then it is saved as an Ancestor Variable.
- You can rearrange the local variables by dragging it up or down in the list.
Steps to manage a Local Variable from the Parameters Panel
- Select the local variable that you want to edit or remove and click icon to display the menu.
Select Edit to edit the variable. This displays the selected local variable in Edit mode. You can edit the value of the local variable in the Local Variable Value field.
Click the Save to save the edited local variable.
- Click OK to save the changes.
- To remove a local variable, select the local variable and click Remove.
- This displays a confirmation screen for the delete operation.
Click Yes to delete the selected variable.
Map Local Variable to Target Element
Once you have created a local variable, you can map it to the specific target element or attribute.