2022.2

Table Of Contents
Initsmostsimpleformthecontentsoftheexpressionrefertoadatafield.Theywillbereplacedwiththe
valueofthatfieldifitexistsinthedatathatispassedtothetemplate.
l
Expressionsinsectionsarealwaysresolvedusingthecurrent recordwithwhichatemplateis
merged.Inotherwords,theinputobjectisthecurrentrecord.
l
InthecaseofHandlebarssnippets,youdetermineinascriptwithwhichdatathesnippetwillbe
merged.See"Handlebarstemplates"onpage774forinstructions.
ExpressionsareinsertedinsectionsandHandlebarstemplatesthesameway;see"Variabledatain
text:expressions"onpage722.
Itispossibletouselogicinanexpression,forexampletodisplaycontentonlyifafieldhasacertain
value.Howthisisdoneisdescribedinanothertopic:"BlockHelpers"onpage767.
Note: InOLConnect(asopposedtotheoriginalHandlebarslibrary),numbersinHandlebars
expressionsdonotneedtobesurroundedbyquotes.Forexample,tocalculate1+2youcan
write(add12)insteadof(add"1""2").
Accessing data at different levels
Afieldorkeynamewithouta.or/isassumedtorefertoafieldortableattherootofthedatawith
whichthetemplateisrendered.Thereareanumberofwaystoaccessdatathatisnotlocatedatthe
root.
l
With.or/youcannavigatedownintotherecordorobject.Forexample:{{Cars.Brand}}and
{{Cars/Brand}}refertothesamefield.
Notethattoaccessaniteminadetailtableorarraydirectly,youalsohavetonavigatedown.For
example:Cars.Brand.Models[0]referstothefirstiteminModels.Alternativelyyoucanwrite:
Cars.Brand.Models.0
l
@rootrepresentsthetoplevelofthedata.
Ifatemplateisrenderedwiththecurrentrecordorpartofit,@rootreferstotherootofthecurrent
record.
WithaJavaScriptobject,@rootreferstotherootlevelofthedatathatwaspassedtotheHandle-
barstemplate.
l
Thebuilt-inhelpers#eachand#withdiveintoanobject-property,givingyoudirectaccesstoits
properties.(See"Usingfunctionsinexpressions:Helpers"onpage766andthedocumentation
ofHandlebars.)
l
Use../tonavigateonelevelup.Thisisparticularlyusefulin#eachand#withblocks.
Page 764