2022.1

Table Of Contents
Get coverage
This helper returns an object whose properties are filled with values based on data fields in the
current context (this). For example, when called within an #each block that is executed with
the records of a detail table, this refers to the current detail table record. (See also: "#with and
#each" on page984.)
Handlebars.registerHelper('getObjectAndCoverage', function () {
let coverage = this.O_L99042;
let category = this.C_L99042
if( category === 'extra' ) {
coverage = 'Extra + glass';
}
return {
"object": "Residential building",
"amount": this.L10039D,
"coverage": coverage,
"premium" : this.L10145
}
})
HTML-escaping in a helper
If a helper needs to HTML-escape a string you can call Handlebars.escapeHTML() in that
function.
For example, if you would want to HTML-escape the value of this.field, but not "<p>" or
"</p>", you could write:
function() { return "<p>" + Handlebars.escapeHTML(this.field) + "</p>"; }
In the original Handlebars library this function is called Handlebars.escapeExpression().
Tip
As a rule of thumb, put as much content in the .hbs file as possible and let helpers
generate as little content as possible.
Partials
Partials are normal Handlebars templates that may be called directly by other templates. This
topic explains how to work with Handlebars partials in OLConnect.
Information about Handlebars templates in OL Connect can be found in the topics "Handlebars
templates" on page781.
Page 986