2021.1

Table Of Contents
DataMapper API
Certain features that can be used in a DataMapper script do not exist in the native JavaScript
library. These are additional JavaScript features, designed for use in Connect only. All features
designed for use in the DataMapper are listed in the DataMapper API (see "DataMapper
Scripts API" on page382).
External JavaScript libraries
The External JS Libraries box on the Settings pane lets you add JavaScript libraries to your
configuration and displays all the libraries that have been imported (see "Settings pane" on
page323).
You can use JavaScript libraries to add more JavaScript functionality to your data mapping
configuration. Any functions included in a JavaScript library that is imported in a data mapping
configuration will be available in Preprocessor scripts as well as Action tasks, Post functions
and JavaScript-based extraction steps.
Take the following JavaScript function, for example:
function myAddFunction(p1, p2) {
return p1 + p2;
};
If this is saved as myFunction.js and imported, then the following would work anywhere in the
configuration:
var result = myAddFunction(25, 12); // returns 37!
Setting boundaries using JavaScript
As soon as you select the On Script option as the trigger for establishing record boundaries
(see "Record boundaries" on page227), you are instructing the DataMapper to read the source
file sequentially and to trigger an event each and every time it hits a delimiter. (What a delimiter
is, depends on the source data and the settings for that data; see "Input data settings
(Delimiters)" on page224).
In other words, the script will be executed - by default - as many times as there are delimiters in
the input data.
If you know, for instance, that a PDF file only contains documents that are 3 pages long, your
script could keep count of the number of times it's been called since the last boundary was set
Page 387