Please enable JavaScript to view this site.

Altova MapForce 2022 Basic Edition

Variables are a special type of component used to store an intermediate mapping result for further processing. Variables can be of simple type (e.g., string, integer, boolean, etc) and complex type (a tree structure). See the examples of both types in the subtopics below.


One of the most important aspects of variables is that they are sequences and can be used to create sequences. The term sequence means a list of zero or more items. This makes it possible for a variable to process multiple items for the duration of the mapping lifetime. For more information, see also Mapping Rules and Strategies. However, it is also possible to assign a value to a variable once and keep this value the same for the rest of the mapping. For details, see Changing the Context and Scope of Variables.


Simple variables

A simple variable is built to represent atomic types such as strings, numbers, and booleans (see screenshot below).



Complex variables

A complex variable has a tree structure. The structures on which a complex variable can be based are summarized in the list below.

MapForce Basic Edition:

XML Schema Structure

MapForce Professional Edition:

XML Schema Structure

Database Structure

MapForce Enterprise Edition:

XML Schema Structure

Database Structure

EDI Structure

FlexText Structure

JSON Schema Structure


Example 1: Variable based on XML Schema

You can create a complex variable by supplying an XML schema which defines the structure of the variable (see screenshot below). If the schema defines any elements globally, you can choose which one should become the root node of the variable structure. Note that a variable does not have an associated instance XML file. The data of the variable is computed at mapping runtime.


Example 2: Variable based on a database

The current example (see screenshot below) is only relevant to MapForce Professional and Enterprise editions. If you choose a database structure for your variable, you can choose a specific database table as the root item for the variable structure.


In both examples above, each variable has an item called compute-when. Connecting this item is optional: This enables you to control how the variable value should be computed in the mapping. For more information, see Changing the Context and Scope of Variables.


Variables with duplicated inputs

When necessary, items of a variable structure can be duplicated to accept data from more than one source connection. This is similar to duplicating inputs in standard components. This does not apply, however, to variables created from database tables. The screenshot below illustrates a simple variable with duplicated inputs.



Chained mappings vs. variables

Variables can be compared to intermediate components of a chained mapping. However, variables are more flexible and convenient if you do not need to produce intermediary files at each stage of the mapping. The table below outlines differences between variables and chained mappings.


Chained mappings


Chained mappings involve two independent steps. For example, a mapping has three components, namely A, B, and C. Step 1: mapping data A to B. Step 2: mapping data from B to C.

You can control when and how often the variable value is computed when the mapping is carried out. For details, see Changing the Context and Scope of Variables.

When the mapping is carried out, intermediate results are stored externally in files.


When the mapping is carried out, intermediate results are stored internally. No external files containing the results of a variable are produced.

The intermediate result can be previewed using the preview button.

The result of a variable cannot be previewed, since it is computed at mapping runtime.


Note:Variables are not supported if the mapping transformation language is set to XSLT 1.0.


© 2016-2022 Altova GmbH