2019.1

Table Of Contents
Changing the type does not only set the data type inside the record. In the case of dates,
numbers and currencies, it also means that the DataMapper will expect the data in the data
source to be formatted in a certain way. If the actual data doesn't match the format that the
DataMapper expects, it cannot interpret the date, number or currency as such. If for example a
date in the data source is formatted as "yyyy-mm-dd" but the default format adds the time, the
date cannot be read and the DataMapper will stop with an error.
The default format for dates, numbers and currencies can be set in the user preferences
("DataMapper preferences" on page1000), in the data source settings ("Data source settings"
on page234) and per data field (in the Extract step properties, see "Data Format" on page349).
Setting a default value
You may want to set a default value for a field, in case no extraction can be made. Make sure to
set the data type of the field via the step properties (see above). Then right-click the field and
select Default Value.
The default value must match the selected data type. If the data type of the field is set to Integer,
for example, you cannot enter a value of 2,3. A default date must be formatted as a DateTime
object ("year-month-day" plus the time stamp, for example: 2012-04-11 12.00 AM); see "Date"
on page291.
Modifying extracted data
To modify extracted data - the contents of a field - you have to write a script. The script can be
entered as a Post function in a location-based field or as an Expression in a JavaScript-based
field.
Post function
On the Step properties pane, under Field Definition, you can enter a script in the Post function
field to be run after the extraction. (Click the Use JavaScript Editor button to open the Script
Editor dialog if you need more space.)
A Post function script operates directly on the extracted data. Its results replace the extracted
data. For example, the Post function script replace("-", ""); replaces the first dash character that
occurs inside the extracted string. The code toLowerCase(); converts the string to lowercase
letters.
Note that the function must be appropriate for the field's data type.
JavaScript Expression
Alternatively you can change a field's Mode from Location to Javascript:
Page 279