The Component Settings dialog box (illustrated below for an XML component) provides the option to specify either absolute or relative paths for various files which may be referenced by the component:
|•||Input files (that is, files from which MapForce reads data)|
|•||Output files (that is, files to which MapForce writes data)|
|•||Schema files (applicable to components which have a schema)|
|•||Structure files (applicable to components which may have a complex structure, such as input or output parameters of user-defined functions, or variables)|
|•||StyleVision Power Stylesheet (*.sps) files, used to format data for outputs such as PDF, HTML and Word.|
|•||Database trace files, in case of database components|
You can enter relative paths directly in the relevant text boxes (shown enclosed in a red frame in the image below).
Before entering relative file paths, make sure to save the mapping file (.mfd) first. Otherwise, all relative paths are resolved against the personal application folder of Windows (Documents\Altova\MapForce2019), which may not be the intended behavior.
You can also instruct MapForce to save all above-mentioned file paths relative to the mapping .mfd file. In the sample image below, notice the option Save all file paths relative to MFD file. If the check box is enabled (which is the default and recommended option), the paths of any files referenced by the component will be saved relative to the path of the mapping design file (.mfd). This affects all files referenced by the component (shown enclosed in a red frame in the image).
Component Settings dialog box
Although the component illustrated above is an XML component, the setting Save all file paths relative to MFD file works in the same way for the following files:
|•||Structure files used by complex input or output parameters of user-defined functions and variables of complex type|
|•||Input or output flat files *|
|•||Schema files referenced by database components which support XML fields *|
|•||Database trace files *|
|•||Input or output XBRL, FlexText, EDI, Excel 2007+, JSON files **|
* MapForce Professional and Enterprise Edition
** MapForce Enterprise Edition only
Taking the component above as an example, if the .mfd file is in the same folder as the books.xsd and books.xml files, the paths will be changed as follows:
C:\Users\altova\Documents\MyMapping\books.xsd will change to books.xsd
C:\Users\altova\Documents\MyMapping\books.xml will change to books.xml
Paths that reference a non-local drive or use a URL will not be made relative.
When the check box is selected, MapForce will also keep track of the files referenced by the component if you save the mapping to a new folder using the Save as menu command. Also, if all files are in the same directory as the mapping, path references will not be broken when you move the entire directory to a new location on the disk.
Using relative paths (and, therefore, enabling the Save all file paths relative to MFD file check box) may be important in many cases, for example:
|•||The location of the mapping on your operating system is likely to change in future.|
|•||The mapping is stored in a directory which is under source control (using a version control system such as TortoiseSVN, for example).|
|•||You intend to deploy the mapping for execution with MapForce Server to a different machine or even to a different operating system.|
If the Save all file paths relative to MFD file check box is not selected, saving the mapping does not modify the file paths (that is, they remain as they appear in the Component Settings dialog box).
© 2019 Altova GmbH