This example illustrates how to create a simple workflow between Altova MapForce and Altova XMLSpy, using Global Resources. Specifically, it shows you how to trigger the execution of a MapForce mapping directly from XMLSpy, and open in XMLSpy the mapping output generated by MapForce. To make this possible, we will create a Global Resource of type "Result of MapForce Transformation", as illustrated below.
Step 1: Create the Global Resource
This step can be performed from both MapForce and XMLSpy.
|1.||On the Tools menu, click Global Resources. (Alternatively, click the Global Resource toolbar button.)|
|2.||Click Add | File.|
|3.||Enter a descriptive name in the Resource alias text box (in this example, "MappingResult").|
|4.||Select the option Result of MapForce Transformation.|
|5.||Click Browse and select the mapping <Documents>\Altova\MapForce2019\MapForceExamples\Tutorial\Tut-ExpReport-multi.mfd. Be patient while the "Inputs" and "Outputs" sections on the dialog box are populated. As shown below, this mapping has one input and two outputs.|
For the scope of this example, we would like to generate each of the two output files to the folder C:\temp, and change the default file name. To achieve this, we will create a configuration for each desired output, as follows:
|1.||Under "Outputs", click Browse next to the first output and enter C:\temp\file1.xml as destination file name. This is the default configuration which will produce the first output file when triggered.|
|2.||Click Add Configuration as a copy... and enter a name for the new configuration (in this example, "Output2").|
|3.||Under "Outputs", click Browse next to the second output and enter C:\temp\file2.xml as destination file name. This is the alternative configuration which produces the second output file.|
Step 2: Trigger the workflow
The Global Resource created in the previous step can now be consumed from XMLSpy, as follows.
|2.||On the Tools menu, click Global Resources.|
|3.||In the "Files" group, click the "MappingResult" Global Resource created previously, and then click View.|
This executes the mapping, produces the default output (file1.xml) and loads it into the main pane of XMLSpy. The file is also saved as C:\temp\file1.xml.
To trigger the mapping execution with the alternative configuration, do the following:
|1.||On the Tools menu, click Active Configuration | Output2.|
|2.||Click Reload when prompted.|
As a result, the alternative output file is loaded into the main pane of XMLSpy. The file is also saved as: C:\temp\file2.xml.
© 2019 Altova GmbH