MapForce allows you to merge multiple files into a single target file.
This example merges multiple source components with different schemas to a target schema. To merge an arbitrary number of files using the same schema, see Processing Multiple Input or Output Files Dynamically.
The CompletePO.mfd file available in the ...\MapForceExamples folder shows how three XML files are merged into one purchasing order XML file.
Note that multiple source component data are combined into one target XML file - CompletePO
•ShortPO is a schema with an associated XML instance file and contains only customer number and article data, i.e. Line item, number and amount. (There is only one customer in this file with the Customer number of 3)
•Customers is a schema with an associated XML instance file and contains customer number and customer information details, i.e. Name and Address info.
•Articles is a schema with an associated XML instance and contains article data, i.e. article name number and price.
•CompletePO is a schema file without an instance file as all the data is supplied by the three XML instance files. The hierarchical structure of this file makes it possible to merge and output all XML data.
This schema file has to be created in an XML editor such as XMLSpy, it is not generated by MapForce (although it would be possible to create if you had a CompletePO.xml instance file).
The structure of CompletePO is a combination of the source XML file structures.
The filter component (Customer) is used to find/filter the data where the customer numbers are identical in both the ShortPO and Customers XML files, and pass on the associated data to the target CompletePO component.
•The CustomerNr in ShortPO is compared with the Number in Customers using the "equal" function.
•As ShortPO only contains one customer (number 3), only customer and article data for customer number 3, can be passed on to the filter component.
•The node/row parameter, of the filter component, passes on the Customer data to "on-true" when the bool parameter is true, i.e. when the same number has been found, in this case customer number 3.
•The rest of the customer and article data are passed on to the target schema through the two other filter components.