2022.2

Table Of Contents
Setting the data type
FieldsstoreextracteddataasaStringbydefault.Thedatatypeofafieldcanbechangedviatheprop-
ertiesoftheExtractstepthatthefieldbelongsto.
1. SelecttheExtractstepthatcontainsthefield.YoucandothisbyclickingonthefieldintheData
Model,oronthestepintheStepspanethatcontainsthefield.
2. OntheSteppropertiespane,underFieldDefinition,settheTypetothedesireddatatype.See
"Datatypes"onpage275foralistofavailabletypes.
Changingthetypedoesnotonlysetthedatatypeinsidetherecord.Inthecaseofdates,numbersand
currencies,italsomeansthattheDataMapperwillexpectthedatainthedatasourcetobeformattedin
acertainway.Iftheactualdatadoesn'tmatchtheformatthattheDataMapperexpects,itcannotinter-
pretthedate,numberorcurrencyassuch.Ifforexampleadateinthedatasourceisformattedas
"yyyy-mm-dd"butthedefaultformataddsthetime,thedatecannotbereadandtheDataMapperwill
stopwithanerror.
Thedefaultformatfordates,numbersandcurrenciescanbesetintheuserpreferences("DataMapper
preferences"onpage786),inthedatasourcesettings()andperdatafield(intheExtractstepprop-
erties,see"DataFormat"onpage331).
Setting a default value
Youmaywanttosetadefaultvalueforafield,incasenoextractioncanbemade.Makesuretosetthe
datatypeofthefieldviathestepproperties(seeabove).Thenright-clickthefieldandselectDefault
Value.
Thedefaultvaluemustmatchtheselecteddatatype.IfthedatatypeofthefieldissettoInteger,for
example,youcannotenteravalueof2,3.AdefaultdatemustbeformattedasaDateTimeobject
("year-month-day"plusthetimestamp,forexample:2012-04-1112.00AM);see"Date"onpage278.
Modifying extracted data
Tomodifyextracteddata-thecontentsofafield-youhavetowriteascript.Thescriptcanbeentered
asaPostfunctioninalocation-basedfieldorasanExpressioninaJavaScript-basedfield.
Post function
OntheSteppropertiespane,underFieldDefinition,youcanenterascriptinthePost functionfieldto
berunaftertheextraction.(ClicktheUse JavaScript Editorbuttontoopenthe"boundaries"on
page370dialogifyouneedmorespace.)
APostfunctionscriptoperatesdirectlyontheextracteddata.Itsresultsreplacetheextracteddata.For
example,thePostfunctionscriptreplace("-","");replacesthefirstdashcharacterthatoccursinsidethe
extractedstring.ThecodetoLowerCase();convertsthestringtolowercaseletters.
Notethatthefunctionmustbeappropriateforthefield'sdatatype.
Page 268