2022.2

Table Of Contents
smallscript-withwhichdatathesnippetwillbemerged.See"Handlebarstemplates"onpage774for
instructions.
HandlebarsisthenameofaJavaScriptlibrarythatimplementsatemplatinglanguage(see
https://handlebarsjs.com/).Itusesatemplateandaninputobjecttogenerateoutput.TheHandlebars
libraryisintegratedinOLConnectDesigner.See:"HandlebarsinOLConnect"onpage763.
Scripts
AssoonasyouwanttodomorethanwhatcanbedonewiththeavailableScriptWizards,self-made
scriptsarethesolution.Youcould,forexample,combinedataoftwoormoredatafieldsinacondition
forconditionaltext.Oryoucouldloadapartofasnippetdependingonthevalueofadatafield.Witha
self-madescriptyoucanachieveanythingthatcanbedonebyanyoftheScriptWizards,andmuch
more.
Thebasicsofscript-writingintheDesignerareexplainedinthefollowingtopic:"Writingyourown
scripts"onpage808.
ControlScripts
Whenoutputisgeneratedfromatemplate,ControlScriptsrunbeforeallotherscripts,whenarecordis
mergedwithacontext.Theydeterminehowdifferentsectionsofthecontextarehandled.Theycan,for
example,makethepagenumberingcontinueoverallPrintsections,splitEmailattachments,oromit
Printsectionsfromtheoutput.
SomefunctionalityisprovidedasaScriptingWizard,forexampleConditionalPrintSections.
See"ControlScripts"onpage838.
PostPaginationScripts
PostPaginationScriptsareruninaPrintcontextafterthecontenthasbeenpaginated.Becausethey
cansearchthroughtheoutputofallPrintsections,andmodifyPrintsections(oneatatime),theymay
beusedtocreateaTableOfContents(TOC),asexplainedinthetopic:"CreatingaTableOfContents"
onpage852.
See"PostPaginationScripts"onpage850.
Loading data
InordertopersonalizethecontentofatemplateintheDesigner,youneedtohaveaDataModelanda
sampleofcustomerdata.AtthedesignstagetheDesignerdoesn'tneedtohaveaccesstoalldata;it
justneedstoknowwhichdatafieldsexistinyourdataanditneedssomedatatobeabletodisplaya
previewoftheoutput.
TogetaccesstoaDataModelanddata,youcanopen:
Page 710