Altova MapForce 2024 Enterprise Edition

An output component (or "simple output") is a MapForce component which enables you to return a string value from the mapping. Output components represent one possible type of target components, but should not be confused with the latter. Use a simple output component when you need to return a string value from the mapping. On the mapping area, simple output components play the role of a target component which has a string data type instead of a structure of items and sequences. Consequently, you can create a simple output component instead of (or in addition to) a file-based target component. For example, you can use a simple output component to quickly test and preview the output of a function (see Example: Testing Function Output). This technique is also useful for mappings which use string serialization (see String Parsing and Serialization). The main purpose of a simple output component is, however, to get back a string when calling the MapForce Server API, without writing any files.


Simple output components should not be confused with output parameters of user-defined functions (see User-Defined Functions). There are some similarities and differences between the two, as follows.


Output components

Output parameters of user-defined functions

Added from Function | Insert Output menu.

Added from Function | Insert Output menu.

Have "string" as data type.

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.


If necessary, you can add multiple simple output components to a mapping. You can also use simple output components in combination with file-based and database target components. When your mapping contains multiple target components, you can preview the data returned by a particular component by clicking the Preview ( ic-preview ) button in the component title bar, and then clicking the Output pane on the Mapping window.


You can use simple output components as follows in MapForce transformation languages:



How it works

BUILT-IN (when previewing the mapping transformation)

You can preview Output components in the same way as you would preview a file-based mapping output—by clicking the Output pane on the Mapping window.

BUILT-IN (when running the MapForce Server execution file)

When you run a compiled MapForce Server execution file (see Compiling a MapForce mapping), the mapping output is returned in the standard output stream (stdout), so you can view it or redirect to a file. For example, assuming that the name of the MapForce server execution file is MyMapping.mfx, use the following syntax to redirect the mapping output to the output.txt file and any errors to the log.txt file:


MapForceServer.exe run MyMapping.mfx >output.txt 2>log.txt


XSLT 1.0, XSLT 2.0, XSLT 3.0

In the generated XSLT files, a simple output component defined in the mapping becomes the output of the XSLT transformation.


If you are using RaptorXML Server, you can instruct RaptorXML Server to write the mapping output to the file passed as value to the --output parameter.


To write the output to a file, add or edit the --output parameter in the DoTransform.bat file. For example, the following DoTransform.bat file has been edited to write the mapping output to the Output.txt file (see highlighted text).


RaptorXML xslt --xslt-version=2 --input="MappingMapToResult1.xslt" --output="Output.txt" %* "MappingMapToResult1.xslt"


If an --output parameter is not defined, the mapping output will be written to the standard output stream (stdout) when the mapping is executed.

C++, C#, Java

In the generated C++, C#, and Java code, the mapping output is written to the standard output of the generated application.


If the mapping contains multiple target components, the generated application concatenates the standard output of each target component and returns it as one unified standard output.


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


© 2017-2023 Altova GmbH