Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

Functions > User-Defined Functions

Calling and Importing User-Defined Functions

Scroll Home Prev Top Next More

After you create a user-defined function, you can call it either from the same mapping where you created it, or from any other MapForce mapping.

To call a user-defined function from the same mapping:

1.Find the function in the Libraries window. You can find the function under the library that you specified when you created the function. If you created the function in the default "user" library, look for the function in the "user" library. To quickly find the function by its name, start typing the name in the Libraries window.

mf_udf_15

2.Drag the function from the Libraries window into the main mapping. You can now connect to it all the required parameters. The result of the function is provided by its output parameter (or several parameters, if applicable).

mf_udf_14

To import user-defined functions from another mapping:

1.Click the Add/Remove Libraries button at the base of the Libraries window. The Manage Libraries window opens.

mf_manage_libraries_window_empty

2.Do one of the following:

 

To import functions as a local library (in the scope of the current document only), click the Add button under the current mapping name.

To import functions as a global library (at program level), click the Add button adjacent to Global Library Imports.

 

Note: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.

 

3.Browse for the mapping file (.mfd) that contains the user-defined function(s), and click Open. A message box appears informing you that a new library has been added, and the new library appears in the Libraries window.

mf_imported_library_notification

You can now use any of the imported functions in the current mapping by dragging them from the Libraries window onto the mapping, see also Add a Function to the Mapping.

 

The Libraries window displays built-in functions and any user-defined functions in the current .mfd mapping file. If you import other .mfd files as libraries into the current mapping as shown above, it will display user-defined functions from any imported files as well. Note that, if you used the same library name across multiple *.mfd files or custom libraries (see Importing Custom Java and .NET Libraries), functions from all available sources appear under the same library name in the Libraries window.

 

If the imported .mfd file contains credentials, these are shown as imported (with a yellow background) in Credentials Manager. By default, imported credentials are not saved with the main mapping, but you can optionally create a local copy and save them in the main mapping, see also Credentials in UDFs.

 

For further information about viewing and organizing function libraries, see Managing Function Libraries.

© 2020 Altova GmbH