2019.1

Table Of Contents
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
page279 and "Settings for location-based fields in a Text file" on page346).
l
Enter a script in a JavaScript-based field (see "JavaScript-based field" on page275).
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, or use JavaScript to add a value to a property
defined in the Preprocessor step.
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 page364 and "Left operand, Right operand" on page367.)
l Further process the resulting record set after the entire extraction workflow has been
executed, via a Postprocessor (see "Postprocessor step" on page268).
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 API). 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
page949.
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
Page 382