Processing Multiple Input or Output Files
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 (or database) into smaller parts
•Merge multiple files into one large file (or load them into a database)
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 ( ) or 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.
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.
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>.
This option is mutually exclusive with the Use File Names from Component Settings option.
Parse Strings to XML, Parse Strings to JSON, Parse Strings to CSV, Parse Strings to FLF, Parse Strings to EDI
When switched on, this option enables the component to accept a string value as input to the root node, and convert it to an XML, JSON, CSV, FLF, or EDI structure, respectively. For more information, see Parsing and Serializing Strings.
Serialize XML to Strings, Serialize JSON to Strings, Serialize CSV to Strings, Serialize FLF to Strings, Serialize EDI to Strings
When switched on, this option enables the component to accept a structure as input, and convert it to string. The input structure can be XML, JSON, CSV, Fixed-length Field, or EDI, respectively. For more information, see Parsing and Serializing Strings.
Multiple input or output files can be defined for the following components:
•Text files (CSV*, FLF* files and FlexText** files)
•Protocol Buffers files**
* Requires MapForce Professional Edition
** Requires MapForce Enterprise Edition
The following table illustrates support for dynamic input and output file and wildcards in MapForce languages.
Dynamic input file name
Wildcard support for
Dynamic output file name
Not supported by XSLT 1.0
Not supported by XSLT 1.0
Not supported by XQuery
XSLT 2.0, XSLT 3.0, and XQuery use the fn:collection function. The implementation in the Altova XSLT 2.0, XSLT 3.0, and XQuery engines resolves wildcards. Other engines may behave differently.