2022.2

Table Of Contents
Handlebarsoffersanumberofbuilt-inBlockHelpersthatletyouuselogicintemplates.Theyaredoc-
umentedonHandlebars'website:https://handlebarsjs.com/guide/builtin-helpers.html.
OfthoseHelpers,thefollowingaresupportedinOLConnect:
l
#if:Conditionallyrendersablock.Anoptional{{else}}sectioninsidetheblockwilldisplaywhen
theconditionisnottrue.
l
#unless:Rendersablockiftheexpressionreturnsafalsyvalue(i.e.avaluethatisconsidered
falsewhenencounteredinaBooleancontext).Anoptional{{else}}sectioninsidetheblockwill
displaywhentheconditionistrue.
l
#each:Allowstoiterateoveralist.Anoptional{{else}}sectioninsidetheblockwilldisplaywhen
thelistisempty.
l
#with:Canbeusedtoworkdirectlywiththepassedobjectorobjectproperty.Anoptional{{else}}
sectionwilldisplayonlywhenthepassedvalueisempty.
InBlockHelpers,thedatavariables@first,@last,@indexcanbeused;seehttps://handle-
barsjs.com/api-reference/data-variables.html.
UnlikeintheoriginalHandlebarslibrary,contentprovidedbyaBlockHelperisnot automatically
HTML-escapedinOLConnect.BlocksaretypicallyusedtogenerateHTML,soitisassumedthatthe
resultconsistsofwell-formedHTML.
Note: IfBlockHelpersareusedinasection,editinginPreviewmodeisnotsupported.Any
changesmadeinPreviewmodearerevertedwhenyouswitchbacktoDesignmode.
Note: Anemptyarrayisconsideredfalsy(i.e.evaluatedasfalse).Thisisnormallynotthecasein
JavaScript,buttheHandlebarslibrarymakesanexception.
Intheloghelper,onlytheinfoerrorlevelissupported.
ThelookuphelperisnotimplementedinOLConnect.
Thedatavariable@keyisnotsupportedinOLConnect.OLConnectonlysupportsiteratingover
arraysandtables,notoverarbitraryobjects.
SincecontentprovidedbyaBlockHelperisnotHTML-escapedinOLConnect,Handlebars'
SafeStringclassisnotneededandthereforenotsupported.
Examples of Block Helpers
#if
Thefollowing#ifblockwilloutputatablerowwithtwocellsifthedatafieldnamedO_L10095isnot
false,undefined,null,0,anemptystring,oranemptyarray.
Page 768