Altova MapForce 2023 Professional Edition

The next step is to create the file name of each output file. For this purpose, we will use the concat function, which concatenates (joins) all the values supplied to it as arguments. When these values are joined together, they will create an output file name (e.g., Publication1.xml). To generate the file names using the concat function, take the steps described below.


Add the concat function

Search for the concat function in the Libraries window and drag it to the mapping area (see screenshot below). By default, this function has two parameters when it is added to the mapping. In our example, we need three parameters. Click gui_add_function_parameter (Add parameter) inside the function component and add a third parameter to it. Note that clicking gui_delete_function_parameter (Delete parameter) deletes a parameter.



Insert a constant

To add a constant, click Constant in the Insert menu. When you are prompted to supply a value, enter publication and leave the String option unchanged. The constant publication supplies the constant string value publication. Connect the constant with value1 of the concat function, as shown in the screenshot below:



Supply the id

Connect the id attribute of the source component with value2 of the concat function. The attribute id of the source XML file supplies a unique identifier value for each file. This is to prevent all files from being generated with the same name. The connection becomes red when you click on it.



Extract the file extension

Search for the get-fileext function in the Libraries window and drag it to the mapping area. Create a connection from the top node of the source component (File: BookTitle*.xml) to the filepath parameter of this function. Then connect the extension parameter of the get-fileext function to value3 of the concat function. By doing this, you are extracting only the extension part (in this case, .xml) from the source file name and pass it to the output file name.



© 2017-2023 Altova GmbH