2022.2

Table Of Contents
Ifyouknow,forinstance,thataPDFfileonlycontainsdocumentsthatare3pageslong,yourscript
couldkeepcountofthenumberoftimesit'sbeencalledsincethelastboundarywasset(thatis,the
countofdelimitersthathavebeenencountered).Eachtimethecountisamultipleof3,itcouldseta
newrecordboundary.ThisisbasicallywhathappenswhensettingthetriggertoOn Pageandspe-
cifying3astheNumberofPages.
Note: Rememberthataboundaryscriptisbeingcalledoneachnewdelimiterencounteredby
theDataMapperparsingalgorithm.Ifforinstanceadatabasequeryreturnsamillionrecords,the
scriptwillbeexecutingamilliontimes!Craftyourscriptinsuchawaythatitdoesn'twastetime
examiningallpossibleconditions.Instead,itshouldterminateassoonasanyconditionitiseval-
uatingisfalse.
Accessingdata
Data available inside each event
Everytimeadelimiterisencountered,aneventistriggeredandthescriptisexecuted.Theeventgives
thescriptaccesstothedatabetweenthecurrentlocation-thestartofarow,lineorpage-andthenext
delimiter.SoatthebeginningoftheprocessforaPDFortextfile,youhaveaccesstothefirstpage
only,andforaCSVorfortabulardata,thatwouldbethefirstroworrecord.
Thismeansthatyoucan:
l
Examinethedatafoundinbetweendelimitersforspecificconditions.
l
Examinespecificregionsofthatdata,ortheavailabledataasawhole.
l
Comparethecontentsofoneregionwithanother.
l
Etc.
Toaccessthisdatainthescript,usetheget()functionoftheboundariesobject.Thisfunctionexpects
differentparametersdependingonthetypeofsourcefile;see"get()"onpage372.
Getting access to other data
Datathatisnotpassedwiththeevent,butthatisnecessarytodefinetherecordboundaries,canbe
storedintheboundariesobjectusingthesetVariablefunction(see"boundaries"onpage370and
"setVariable()"onpage374).Thedatacanberetrievedusingtheboundaries'getVariablefunction
(see"getVariable()"onpage372).
Thiswaythescriptcanaccessvaluesthatwereevaluatedinpreviouspagesorrows,acrossdelimiters,
soyoucaneasilysetrecordboundariesthatspanovermultipledelimiters.
Formoreinformationonthesyntax,pleasereferto"DataMapperScriptsAPI"onpage360.
Page 365