Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Current »

Using a simple variable

IdealDoc expressions are some contents enclosed by double curly braces {{}}. In the below template, firstname is a variable that is enclosed by double curly braces, which is said to be an expression.

{{firstname}} {{lastname}}

If the below input object is applied to the template.

{
  firstname: "Yehuda",
  lastname: "Katz",
}

Expressions are compiled to produce the output as follows:

Yehuda Katz

Path expressions

IdealDoc expressions can also be dot-separated paths.

{{person.firstname}} {{person.lastname}}

This expression looks up the person property in the input object and in turn looks up the firstname and lastname property within the person object.

Pass the below input object to the template.

{
  person: {
    firstname: "Yehuda",
    lastname: "Katz",
  },
}{
  person: {
    firstname: "Yehuda",
    lastname: "Katz",
  },
}

Output will be generated as below:

Yehuda Katz
  • No labels