Binding keys and Scope

Basic concepts

The standard binding format is:

{ "BindingType": "Type", "BindingKey": "Path" }

Some bindings have more parameters, but they will be explained on a case-by-case basis. BindingType indicates the type of binding used, and the BindingKey indicates the path to the needed data. To learn more about binding types, read through the sections on bindings in Word, PowerPoint and Excel.

Binding keys

If you already know a bit about data transformations using JMESPath, you'll notice that the binding keys access data in a very similar manner. Assume that the following dataset is a result of a transformation and ready to be applied to a template.

{
   "title": "Product Quote",
   "contact": {
     "name": "John Doe"
   },
   "products": [
     {
       "name": "Grey Tile",
       "price": "40 $"
     },
     {
       "name": "White Tile",
       "price": "39 $"
     }
   ]
 }

Note that the terms path and the value of the key specified by the path are used somewhat interchangeably throughout the documentation. This is because the path expression normally evaluates to the value at that location. For example, these are some JSON paths that can be used as binding keys and the values that they would yield if used in a standard Field binding for inserting text:

title -> "Product Quote"
contact.name -> "John Doe"
products[0].name -> "Grey Tile"
products[0].price -> "40 $"
products[1].name -> "WhiteTile"
products[1].price -> "39 $"

Some binding types immediately evaluate the value as a boolean. For example, the Visibility binding, that determines the visibility of a portion of a document, only checks if the value evaluates to true or false.

Paths and scope

You might notice that, to fetch a property, we only use the name of the property. That's because the current scope is set to the entire object that is used to populate a template. The scope can change in some situations, e.g., by creating a List binding that covers a bulleted list and using a JSON path to an array as the BindingKey. Then, if we create Field bindings inside the bulleted list, the scope of the nth bullet will be the nth element of the array.

To access the current scope, we use the current scope operator @. We can also access elements outside of current scope by using the parent function.