This example illustrates how mapping output can be redirected to different folders by means of Global Resources.
Let's suppose that sometimes you need to generate the mapping output to one directory (for example, C:\Testing), while in certain cases output must be generated to another directory (for example, C:\Production). With Global Resources, this is possible by creating a folder alias with two configurations:
1."Default" configuration - Generates output to C:\Testing
2."Production" configuration - Generates output to C:\Production.
The steps below illustrate how to achieve this goal.
The folder alias can be created as follows:
1.On the Tools menu, click Global Resources. (Alternatively, click the Global Resource toolbar button.)
2.Click Add | Folder.
3.Enter a name in the Resource alias text box (in this example, "OutputDirectory" could be an appropriate name).
4.Click Browse and select the following folder: C:\Testing. (Make sure that this folder already exists on your operating system.)
5.Click Add Configuration and enter a name for the new configuration (in this example, "ProductionDirectory").
6.Click Browse and this time select the following folder: C:\Production. (Make sure that this folder already exists on your operating system.)
The required Global Resource has now been created; however, the mapping is not using it yet. To change the mapping so that it uses from the previously defined folder alias (Global Resource), do the following:
1.Open the following mapping <Documents>\Altova\MapForce2021\MapForceExamples\Tutorial\Tut-ExpReport.mfd.
2.Right-click the target component on the mapping, and select Properties from the context menu.
3.Next to Output XML file, click Browse.
4.Click Switch to Global Resources, and then click Save.
5.When prompted to save the output XML file, enter output.xml (or another descriptive file name that you wish to give to the output file). The output XML file path has now become altova://folder_resource/OutputDirectory/output.xml, which indicates that the path is defined as a Global Resource.
You can now easily switch to the desired mapping output folder file before running the mapping, as follows:
•On the Tools menu, click Active Configuration | Default, and then click the Output tab to preview the mapping result. The mapping output (either a temporary or a permanent file, as explained below) will be generated in the C:\Testing directory.
•On the Tools menu, click Active Configuration | ProductionDirectory, and then click the Output tab. The mapping output (either a temporary or a permanent file, as explained below) will be generated in the C:\Production directory.
|Note:||The mapping output is written by default as a temporary file, unless you explicitly configured MapForce to write output to permanent files.|
To configure MapForce to generate permanent files instead of temporary, do the following:
1.On the Tools menu, click Options.
2.In the General section, select the option Write directly to final output files.