Altova MapForce 2024 Enterprise Edition

Local and Global Libraries

Home Prev Top Next

You can import libraries locally or globally. Global imports are at application level. If a library was imported globally, you can use its functions from any mapping.

 

Local imports are at mapping file level. For example, let's suppose that, while working on mapping A.mfd, you decide to import all user-defined functions from mapping B.mfd. In this case, mapping B.mfd is considered to be imported as a local library into A.mfd and you can use functions from B.mfd in A.mfd as well. Likewise, if you import functions from an XSLT file into A.mfd, this is also a local import.

 

You can view and manage all local and global imports from the Manage Libraries window. To import a library, do one of the following:

 

1.Click the Add/Remove Libraries button at the bottom of the Libraries window. The Manage Libraries window opens (see screenshot below).

mf_manage_libraries_window_empty

2.To import functions as a local library (in the scope of the current document only), click Add under the current mapping name. To import functions as a global library (at program level), click Add next to Global Library Imports. When you import a library locally, you can set the path of the library file to be relative to the mapping file. With globally imported libraries, the path of the imported library is always absolute.

 

Conflicting function names

You may come across situations where the same function name is defined at any of the following levels:

 

in the main mapping

in a library that was imported locally

in a library that was imported globally

 

When it encounters such cases, MapForce will attempt to call the function exactly in the order above, to prevent ambiguity. That is, the function defined directly in the mapping takes precedence if the same function name exists in a locally imported library. Also, the function imported locally takes precedence over the function imported globally (assuming that both functions have the same name).

 

If multiple functions with the same name exist, only the "winning" function will be called, according to the rule above; any other ambiguous function names will be blocked. Such blocked functions appear as grayed out in the Libraries window, and it is not be possible to use them in the mapping.

© 2017-2023 Altova GmbH