Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected links that should have been relative instead of absolute.

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

  1. Ensure that the source and target schemas destination layout are loaded and all their elements are listed under their respective nodes.
  2. Click Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
  3. Click the Local Variables tab. The Local Variable pane is displayed in the Mapping Graph Area (see Figure 527).

    Image Removed

    Figure 527: Local Variable Pane

  4.  Click Local Variable Name text field and enter Click the Add Parameters icon and select Variables to display Create New Variable tab.

    Image Added

  5. Select Local Variables to enter the details of local variables.

    Image Added

  6.  Enter the name of the local variable you want to create (e.g. varQuery). Press the Tab or Enter key. This takes the control to the Local Variable Value field.
  7.  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

    Enter comments for the local variable in the Add Comment field (see Figure 528). For example, if the local variable value contains complex XSLT logic, you can enter its description in this field.

     

    The Comments field is resizable.

     

    Image Removed
    Figure 528: Enter Name, Value and Comment for Local Variable

    • Info
      To select a Custom Method as the value of a
    local
    • global variable,
    double
    • click
    the desired 
    • the Custom Method
     under Custom Methods
    •  in the Parameters Panel.
    The selected Custom Method is displayed in the Variable Definition field.

    Click the Save Local Variable ( Image Removed ) button to save the local variable for the selected target element. This local variable is added to the list of existing variables in the Local Variable Name field. It is also displayed under Local Variables in the Parameters Panel. If you shift the focus to another node, or click any of the Mapping Rules, Textual Rules, Global Variables, Properties, XSL or Debugger tabs, without saving the local variable, an alert message is displayed (refer to alertmsg Figure 522). The comments added for the local variable are saved and displayed above the local variable declaration in the Mapping XSL (refer to Figure 523).

     

    The alert message is also displayed when shifting focus between Global and Node tabs.

  8. Click No to save the local variable and shift the focus to the other object. If you click Yes, then the defined local variable is cleared and the focus is shifted to the other object.

 

...

  1. 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.

  2. 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

 

  1. Right-click Select the local variable that you want to edit or delete. This displays the right dropdown remove and click Image Added icon to display the menu. 
  2. 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. You can also edit the name of the local variable in the Local VariableName field (see Figure 529).

    Image Removed

    Figure 529: Edit Name, Value and Comment for Local Variable

    Click the Save Local Variable ( Image Removed ) button  

    Image Added

  3. Click the Save to save the edited local variable. An alert message is displayed.

    Image Removed

    Figure 530: Alert Message

     

  4. Click OK to save the changes.
  5.  To remove a local variable, select the local variable and click Remove selected local variable (Image Removed) button.

    To remove all local variables, click Remove all local variables (Image Removed) button.

    Alternately, you can delete a local variable from the Parameters Panel itself. For details, refer to the Managing a Global Variable from Parameter Panel section.

    .
  6. This displays a confirmation screen for the delete operation.

    Image Added

  7. 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

    Steps to map Local Variable to specific target element

  8. Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
  9. Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed. Click Mapping Rules tab.
  10. Select a target element. This displays the selected target element node in the Mapping Graph Area.
  11. Double-click the required local variable under Local Variables in the Parameters Panel. The selected local variable node is displayed in the Mapping Graph Area (see Figure 531).

    Image Removed

    Figure 531: Add Local Variable Node

  12. Create a link from the output of the local variable to the input of the target element

    .

    Click the Apply Mapping

     

    Image Removed ) button. This maps the local variable to the selected target element. If you shift the focus to another target element, or click any of the Global, XSL or Debugger tabs, without applying the mapping, then an alert message is displayed (refer to Figure 522).

    Click No to apply the mapping and then shift focus to the other object. If you click Yes, then the mapping activity is cleared and is replaced by the previous mapping in the Mapping Graph Area and the focus is shifted to the other object.

     

    • Once a local variable is mapped to a target element, the letter (LV) is displayed next to the mapped target element. This signifies that a local variable has been mapped to the target element. The letter (M) is also displayed indicating the target element has been mapped. Refer to Table of Suffixes for details on suffixes displayed next to a target element.
    • Local variables do not allow duplicate names at the same level. You need to right-click to edit the local variable, where you can select the source.

    Save the mapping activity and exit the Data Mapper.

     You can view and validate the generated mapping XSLview the target XML and view and validate mapping output, before saving the mapping activity.