Skip to content

Work with expressions

An expression tells a field what to display. It can be as simple as a customer name, or a small calculation such as adding tax to a total.

Field suggestions in the live expression example.
Field suggestions in the live expression example.

Type this. into the expression box. Suggestions show the fields in the selected data. Start typing the field name to narrow the list, then press Enter or Tab to choose it. You can also type / or press Ctrl+Space to open the list. Use Escape to close it. This uses the same field suggestions as the Word add-in.

Try an expression with field suggestions

Open full example ↗
Sample data Edit JSON

Loading sample…

What you want What to enter With our sample
Customer name this.CustomerName Alpine Studio
Add 20% to a total this.Total * 1.2 2940
Show two decimal places this.Total.ToString("N2") The total with two decimal places
Choose a message this.Approved ? "Ready" : "Draft" Ready

The example uses English (UK) number formatting. Edit the JSON directly to try different values. There is one data object: this refers to the JSON you supply. The result updates as you type.

For list-item expressions, paste a single item as the JSON data and try this.Product. In Word repeating sections, this refers to the current item, root to the whole report, and block["Lines"] to the surrounding Lines item. See the syntax reference.

Check the field spelling and quotation marks against your JSON data. A number entered in quotation marks is text, so calculations may fail. An empty list has no first item. Your expression and data stay in place when a run fails; correct them and the result updates automatically.

Word bindings can contain at most 64 characters. If an expression becomes long, ask the person providing your data to supply the combined value as a field.

The full syntax reference is available for advanced authors and developers.