meta
The meta
object can hold additional information about a section (see section). This property is initially empty, and is reset after every record.
meta
entries can be added in a script, preferably in a Control Script so that they are available in all Standard Scripts and in Handlebars expressions. If added in a Standard Script, they are available in all subsequent scripts, but not in Handlebars expressions.
The values stored in section.meta
can have any type; they are not converted to strings.
Example: The following line of code writes a text in the meta
property of a section, in a new entry 'title'.mySection.meta["title"] = "New title"
By default, a Clone Section script adds three entries to the meta property; see meta entries in section clones.
Meta
entries can be read in a Standard Script.
Example: Selector: h1. Code:let theTitle = merge.section.meta["title"]
results.text(theTitle)
Meta
entries are also accessible in Handlebars expressions.
Example: {{@meta.title}}
Note: If a meta
entry is added by a Standard Script, it cannot be accessed in a Handlebars expression, since Handlebars expressions are evaluated before Standard Scripts run.
Note: A section's meta
property is not accessible to Handlebars expressions in a Handlebars template that is rendered using a Control Script (see Inserting a Handlebars template using a script). For @meta entries to be accessible, the Handlebars template must be rendered in a Standard Script instead.