Please enable JavaScript to view this site.

Altova MapForce 2021 Basic Edition

Designing Mappings

Supplying Parameters to the Mapping

Scroll Home Prev Top Next More

If you need to create a mapping that takes parameters as input, you can do so by adding a special component type called "simple input component". Simple input components always have a simple data type (for example, string, integer, and so on) instead of a structure of items and sequences. For example, in the mapping illustrated below, there is a simple input component count. Its role is to supply as parameter the maximum number of rows that should be retrieved from the source XML file (with value 10 as default). Importantly, the nodes supplied as input to the first-items function are sorted with the help of a sort component, so the mapping outputs the highest N temperatures only, where N is the parameter's value.

mf_simple_input_05

FindHighestTemperatures.mfd

Another fairly common usage of simple input components is to supply a file name to the mapping. This is useful in mappings that read input files or write output files dynamically, see Processing Multiple Input or Output Files Dynamically. In the generated XSLT file, simple input components correspond to stylesheet parameters.

 

You can create each simple input component (or parameter) as optional or mandatory, see Adding Simple Input Components. If necessary, you can also create default values for the mapping input parameters, see Creating a Default Input Value. This enables you to safely run the mapping even if you do not explicitly supply a parameter value at mapping execution time. For an example, see Example: Using File Names as Mapping Parameters.

 

Input parameters added on the main mapping area should not be confused with input parameters in user-defined functions. There are some similarities and differences between the two, as follows.

 

Input parameters on the mapping

Input parameters of user-defined functions

Added from Function | Insert Input menu.

Added from Function | Insert Input menu.

Can have simple data types (string, integer, and so on).

Can have simple as well as complex data types.

Applicable to the entire mapping.

Applicable only in the context of the function in which they were defined.

 

When you create a reversed mapping (using the menu command Tools | Create Reversed Mapping), a simple input component becomes a simple output component.

© 2015-2021 Altova GmbH