2021.1

Table Of Contents
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 a
Action step script.
l Add a value to a custom property defined in the Preprocessor step. (See "Properties
and runtime parameters" on page228.) 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367 and "Multiple Conditions step properties" on page370.)
l Further process the resulting record set after the entire extraction workflow has been
executed, via a Postprocessor (see "Postprocessor step" on page265).
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 page382). 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.
Keyboard shortcuts for the script editor are listed in the following topic: "Keyboard shortcuts" on
page1031.
Syntax rules
In the DataMapper, all scripts must be written in JavaScript, following JavaScript syntax rules.
For example, each statement should end with ; and the keywords that can be used, such as var
to declare a variable, are JavaScript keywords. There are countless tutorials available on the
Internet to familiarize yourself with the JavaScript syntax. For a simple script all that you need to
know can be found on the following web pages: W3Schools website - JavaScript Syntax and
https://www.w3schools.com/js/js_if_else.asp. A complete JavaScript guide for beginners can
be found here: https://developer.mozilla.org/en-US/docs/Web/JavaScript.
Page 386