Add a Variable
This topic explains how to add a variable to a mapping. The first option is to add a variable via the menu or toolbar command. The second option allows you to add a variable via the context menu.
Option 1: via the menu or toolbar command
This option enables you to add a variable via the menu or toolbar command. Take the steps below:
1.Go to the Insert menu and click Variable. Alternatively, click the toolbar button (Variable).
2.Select the type of variable you want to insert (simple or complex type).
If you select Complex type, there are a few additional steps:
3.Click Choose to select the source which should provide the structure of the variable. The structures illustrated in the screenshot below only apply to MapForce Enterprise Edition. See the list of structures relevant to other MapForce editions in the previous topic.
4.When prompted, specify the root item of the structure of the variable. For example, in XML schemas, you can select any element or type from the selected source (see screenshot below).
Option 2: via the context menu
The second option allows you to create a variable using the context menu. The possible options are listed below.
Variable from a source node
To create a variable from a source node, right-click the output connector of a component (in this example, the output connector of the <Article> element) and select Create Variable from Source Node (see screenshot below).
This creates a complex variable with the source schema of the Articles component. All the items are automatically connected with a copy-all connection (see screenshot below).
Variable from a target node
To create a variable from a target node, right-click the input connector of a target component and select Create Variable for Target Node. This creates a complex variable with the same schema as in the target. All the items are automatically connected with a copy-all connection.
Variable from a filter:
To create a variable using a filter, right-click the output connector of a filter component (on-true/on-false) and select Create Variable from Source Node. This creates a complex component with the source schema and automatically uses the item linked to the filter input as the root element of the intermediate component.