Skip to main content Link Search Menu Expand Document Toggle dark mode Copy Code (external link)
paperwork.help

../ : Parent Context

Refers to the enclosing data context - the item one level up from the current with block or loop.


On this page

Syntax

{{../property}}

Single level only

../ moves up one level. It cannot be chained - ../../ is not supported. To reach a value further up, use its data name from the top, such as {{model.title}}, which is available everywhere.


Examples

Data:

builder.WithData("model", new {
    title = "Fleet Report",
    groups = new[] {
        new { name = "Vans", vehicles = new[] { "V1", "V2" } }
    }
});

Template:

{{#with model}}
    {{#with groups[0]}}
        <h2>{{name}} - part of {{../title}}</h2>
    {{/with}}
{{/with}}

{{#each model.groups}}
    {{#each this.vehicles}}
        <p>{{this}} in {{../name}}</p>
    {{/each}}
{{/each}}

Output:

Vans - part of Fleet Report
V1 in Vans
V2 in Vans

Notes

  • At the outermost with block or loop, the enclosing context is the document’s data itself, so use the data name directly - {{model.currency}}, not {{../currency}}.
  • Data names such as model never need ../.
  • Write the parent’s property directly after ../ - {{../name}}. {{../this.name}} gives no value, and {{../.name}} is not valid.
  • ../../ gives no value (there is no error).
  • Requires Paperwork.Core 9.8 inside loops; earlier versions support `../` inside blocks only.

See Also