By using variables, you can calculate a value that is required in multiple target-field mappings in a block before the target-field mapping is executed. Thus, if the target-field mappings of numerous target fields are identical, you can save time when defining the target-field mapping by defining it once for a variable and then assigning the variable to all other target fields.
1. To create a variable, call the context menu for a field in the target structure that has additional sub elements in the structure, and choose Add Variable (). The mapping editor inserts the variable as the first sub node for the field. It is visible for all nodes on the same hierarchy level, and for all sub nodes.
2. To use a variable V as a target field, double-click the variable. You can now define a target-field mapping for variable V in the data-flow editor. In this target-field mapping, you can also use the values of variables that come before variable V in the structure.
3. To use a variable as a source field in a target-field mapping, drag the variable to the data-flow editor by using drag and drop.
In the following example, a date is to be constructed from the elements Month, Day and Year. The date is then required for a target-field mapping to the elements Date and TimeStamp. You can simplify both target-field mappings by using the variable DateVar: