2022.2

Table Of Contents
Object Usage
"context"on
page842
Objectthatcontainsonecontextanditssections.Itisaccessedthroughthetemplateobject:merge.template.contexts.To
getaccesstoonecontext,youhavetospecifytheContextType(see"ContextType"onpage838),forexample:var printCon-
text = merge.template.contexts.PRINT;.
Throughthemergeobjectyoucanfindoutwhichcontextiscurrentlybeingmerged:merge.context.
"masterpage"on
thenextpage
ThemasterpageobjectisusedtosetaMasterPage'sheaderandfooterortoreplaceitsentireHTMLbody.
"merge"on
page856
Themergeobjectgivesaccesstothetemplatewithallofitscontextsandsections.
"record"on
page744
Thecurrentrecordinthemaindataset.Togetthevalueofafieldintherecord,userecord.fields['fieldname']or
record.fields.fieldname.
"section"on
page848
MuchoftheControlScriptmagicisperformedbysettingoneofthefieldsofthesectionobject.Viathesectionobjectyoucan
omit,selectandclonesections;addabackgroundtoaPrintsection;addaheadertoanemail;etc.
Asectioncanberetrievedviathecontextthatitbelongsto,usingmerge.template.contexts.ContextType.sections["sec-
tion name"].Forexample:merge.template.contexts.PRINT.sections["Section EN"].
"template"on
page835
Thetemplateobjectcontainsallcontextsandsections.Itisaccessedthroughthemergeobject:merge.template.
context
InaControlScript,thecontextobjectrepresentsonecontextinthetemplate.
Whichcontextsareavailableinthetemplatecanbequeriedusingmerge.template.contexts.
Thecontextbeingmergedcanbequeriedusingmerge.context.
Field Type Description
sections
Array Arrayofsections(see"section"onpage848)insideaparticularcontextdefinedinthetemplate.
Note: Whenusingmerge.context.sectionskeepinmindthatforexample'SectionX'
mightonlyexistinyourPrintcontext,sousingmerge.context.sections['Section X']
withoutenclosingitintheifstatementif (merge.context.type == Con-
textType.PRINT) {}willyieldanerrorwhenthescriptrunsforothercontexts.
Alternatively,usethetemplate objecttoaccessaspecificcontext:merge.tem-
plate.contexts.PRINT.sections['Section X'].
type
"ContextType"on
page838
Thecontexttype:PRINT,EMAILorWEB.
Page 815