2022.1

Table Of Contents
A script can be used to set boundaries for a data source (see "Setting boundaries using
JavaScript" on page414). The script determines where a new record starts.
Scripts can also be used in different steps in the extraction workflow. You can:
l Modify the incoming data prior to executing the rest of the extraction workflow, via a
Preprocessor (see "Preprocessor step" on page279).
l Edit extracted data in a field of the Data Model using a Post function script (entered on
the Step properties pane, under Field Definition; see "Modifying extracted data" on
page301 and "Extract step properties" on page369).
l Enter a script in a JavaScript-based field (see "Expression-based field" on page297).
Note that the last value attribution to a variable is the one used as the result of the
expression. It is possible to refer to previously extracted fields if they are extracted higher
in this list or in previous Extract steps in the extraction workflow.
l Let an Action step run a JavaScript, for example to:
l Extract data to fields at the root level or in a detail table. See Extracting data with an
Action step script.
l Add a value to a custom property defined in the Preprocessor step. (See "Properties
and runtime parameters" on page253.) Note that only the value of properties of
which the scope is set to "Each record" can be changed in a script.
l Change the left and right operands in a Condition step to a JavaScript expression. (On
the Step properties pane, under Condition, set Based on to JavaScript; see "Condition
step properties" on page393 and "Multiple Conditions step properties" on page396.)
l Further process the resulting record set after the entire extraction workflow has been
executed, via a Postprocessor (see "Postprocessor step" on page289).
The script can always be written directly in a small script area or in the Edit script dialog. To
invoke this dialog click the Use JavaScript Editor button .
Tip
In the Edit script dialog, press Ctrl + Space to bring up the list of available JavaScript
objects and functions (see "DataMapper Scripts API" on page408). Use the arrow keys
to select a function or object and press enter to insert it. Type a dot after the name of the
function or object to see which features are subsequently available.
Page 412