Processing Multiple Input or Output Files Dynamically

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Designing Mappings >

Processing Multiple Input or Output Files Dynamically

You can configure MapForce to process multiple files (for example, all files in a directory) when the mapping runs. Using this feature, you can solve tasks such as:

 

Supply to the mapping a list of input files to be processed
Generate as mapping output a list of files instead of a single output file
Generate a mapping application where both the input and output file names are defined at runtime
Convert a set of files to another format
Split a large file into smaller parts
Merge multiple files into one large file

 

You can configure a MapForce component to process multiple files in one of the following ways:

 

Supply the path to the required input or output file(s) using wildcard characters instead of a fixed file name, in the component settings (see Changing the Component Settings). Namely, you can enter the wildcards * and ? in the Component Settings dialog box, so that MapForce resolves the corresponding path when the mapping runs.
Connect to the root node of a component a sequence which supplies the path dynamically (for example, the result of the replace-fileext function). When the mapping runs, MapForce will read dynamically all the input files or generate dynamically all the output files.

 

Depending on what you want to achieve, you can use either one or both of these approaches on the same mapping. However, it is not meaningful to use both approaches at the same time on the same component. To instruct MapForce which approach you want to use for a particular component, click the File ( btn_file ) or File/String ( btn_file_string ) button available next to the root node of a component. This button enables you to specify the following behavior:

 

Use File Names from Component Settings

If the component should process one or several instance files, this option instructs MapForce to process the file name(s) defined in the Component Settings dialog box.

 

If you select this option, the root node does not have an input connector, as it is not meaningful.

file_default_bas

If you did not specify yet any input or output files in the Component Settings dialog box, the name of the root node is File: (default). Otherwise, the root node displays the name of the input file, followed by a semi-colon ( ;), followed by the name of the output file.

 

If the name of the input is the same with that of the output file, it is displayed as name of the root node.

file_name_basic

Note that you can select either this option or the Use Dynamic File Names Supplied by Mapping option.

Use Dynamic File Names Supplied by Mapping

This option instructs MapForce to process the file name(s) that you define on the mapping area, by connecting values to the root node of the component.

 

If you select this option, the root node gets an input connector to which you can connect values that supply dynamically the file names to be processed during mapping execution. If you have defined file names in the Component Settings dialog box as well, those values are ignored.

 

When this option is selected, the name of the root node is displayed as File: <dynamic>.

file_name_dynamic_bas

This option is mutually exclusive with the Use File Names from Component Settings option.

 

Multiple input or output files can be defined for the following components:

 

XML files
Text files (CSV*, FLF* files and FlexText** files)
EDI documents**
Excel spreadsheets**
XBRL documents**

 

* Requires MapForce Professional Edition

** Requires MapForce Enterprise Edition

 

The following table illustrates support for dynamic input and output file and wildcards in MapForce languages.

 

Target language

Dynamic input file name

Wildcard support for
input file name

Dynamic output file name

XSLT 1.0

*

Not supported by XSLT 1.0

Not supported by XSLT 1.0

XSLT 2.0

*

*(1)

*

C++

*

*

*

C#

*

*

*

Java

*

*

*

BUILT-IN

*

*

*

 

Legend:

 

*

Supported

(1)

Uses the fn:collection function. The implementation in the Altova XSLT 2.0 and XQuery engines resolves wildcards. Other engines may behave differently. For details on how to transform XSLT 1.0/2.0  code using the RaptorXML Server engine, see Generating XSLT 1.0, or 2.0 code


© 2019 Altova GmbH