2022.2

Table Of Contents
Ifthenameofthepropertycontainsaspaceyou'llneedtoputitbetweenbracketsandquotationmarks:
contentitem.properties['name with spaces'] = 'value';
Ifthevalueisanumberyoudon'tneedtoputitbetweenquotationmarks:
contentitem.properties.custom_property = 123;
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.
Function Description
"query(selector)"on
thenextpage
RunsaqueryacrossallsectionsinthePrintcontext.ThisfunctionisonlyavailableinPostPaginationScripts,whichareonly
appliedtothePrintcontext.See"PostPaginationScripts"onpage410.
Example
ThisscriptchecksiftheoutputchannelisEMAILandifthecontexttobemergedisthePrintcontext
(whichhappensifthePrintcontextisattachedtoanemail).Ifthisisthecase,itincludesandexcludes
certainPrintsectionsfromtheoutput.
if (channel == Channel.EMAIL) {
if (merge.context.type == ContextType.PRINT) {
Page 841