Help Center
Go to siteOpen app
  • Help Center
  • Welcome to the Help Center!
  • Guides
    • Designing a Basic Template from Scratch
    • Adding Variables
    • e-signatures with SignNow
    • How to create Tables
  • Templates
    • What's a template?
    • Page Elements
      • Layout Elements
      • Content Elements
      • Conditional Logic
      • Repeating Elements
    • Settings
    • Headers & Footers
    • Data and Variables
      • Syntax
      • Data Types
      • Formatting
      • Functions
        • $calc (beta)
      • Operators
    • Template Designer v2 (Beta)
      • Connections
        • Airtable Connection
        • HubSpot (Coming Soon)
      • Fields Editor
      • Tokens
      • Coming soon
  • Documents
    • What is a Document?
    • Minted Documents
  • Additional Resources
    • How-To Videos
      • Formatting Variables
      • Airtable Integrations
      • Airtable Data and Variables Videos
      • How to add variable images from your Airtable attachments
      • How to filter items in your Documents
      • How to group items in your Documents
      • Signing Documents with SignNow and Zapier
      • Add charts to your Documents with QuickChart.io
      • Add a Word Cloud chart to your Documents with QuickChart.io
      • Using Make.com (Integromat) to create line items in your documents
      • How to QR codes to your documents with QuickChart.io
      • How to add a progress chart to your documents with QuickChart.io
      • How to connect your Documint account using API keys
      • How to connect your Documint account to Airtable using your Personal Access Token (PAT)
    • Glossary
    • Frequently Asked Questions
    • Troubleshooting
  • Integrations
    • HubSpot
      • Installing the Documint app
      • Connecting your Documint account
      • Navigating the Documint App
      • Working with Custom Object Data
      • Adding HubSpot Properties to Your Template
      • Generating Your documents
      • Using Quick-Create
      • Using Workflows to Create Your Documents
      • Troubleshooting the Documint App
      • Uninstalling the Documint App
    • Airtable
      • Add your Airtable Personal Access Token
      • Airtable Extension
      • Generation Link
      • Automation Script
      • Field Types to Documint Variables
      • Adding Images from Airtable
      • Expanding Linked Records
      • Lookup Fields
      • Documents from Multiple Records
      • Duplicate Document Prevention
      • Password Protection
      • Creating Documents
        • Preview Mode
    • Zapier
    • Make.com
    • Coda
    • Stacker
    • Noloco
    • Softr
    • Pory
    • REST API
Powered by GitBook
On this page
  • Strings
  • Numbers
  • Booleans
  • Objects
  • Arrays
  • Collections

Was this helpful?

  1. Templates
  2. Data and Variables

Data Types

Learn how to work with different data types in your templates.

Data can be sent to Documint in several different types. Below is a list of those types and how to use them in your templates.

Strings

Strings are simply text data.

Example

{{customer_name}}

{
    customer_name: "Acme Co."
}

Acme Co.

Numbers

Numbers are integers or floating-point decimals.

Example

{{total_amount}}

{
    total_amount: 149.99
}

149.99

You can format numbers using the $number format.

Booleans

Booleans are values that are either true or false . They can not contain any values other than these.

Example

{{is_fragile}}

{
    "is_fragile": true
}

true

Objects

Objects are groups of key-value pairs. Unlike strings, numbers, and booleans, objects have nested properties that you access using dot notation. For example, let's say that we have an object named address with 4 properties; street1, city, state, and country and we want to display the street1 property we'll use the following token {{ address.street1 }}. If we were to use a token with the name of the object (eg. {{ address }}) this would result in [object Object].

Example

{{address.street1}}

{
    "address": {
        "street1": "123 Main St.",
        "city": "New York",
        "state": "NY",
        "country": "United States"
    }
}

123 Main st.

If a variable is set to the name of the object rather than a property of that object, it will render as [object Object]. For example, if the variable in the template in the example above was {{ address }} instead of {{address.street1}} this would render as [object Object] because the entire address object is trying to be rendered instead of a property (eg. street1) of that object.

Arrays

An array is a list of items. This can be a list of any other data type, including objects (an array of objects is called a collection) and other arrays. Arrays are what you will use to repeat/loop elements in your template.

Example 1: Display a single item

{{movies[0]}}

{{movies[2]}}

{
    "movies": [
        "Cinderella",
        "Avatar",
        "Million Dollar Baby",
        "Toy Story"
    ]
}

Cinderella

Million Dollar Baby

Example 2: Display all items

{{#each movies }} Movie: {{this}} {{/each}}

{
    "movies": [
        "Cinderella",
        "Avatar",
        "Million Dollar Baby",
        "Toy Story"
    ]
}

Movie: Cinderella Movie: Avatar Movie: Million Dollar Baby Movie: Toy Story

[object Object] Error

Similar to objects you cannot display the array itself. If you do, this will result in [object Object] being displayed. Unlike objects, arrays must be either looped over to display each item in the array or display a specific item in the array.

Collections

A collection is an array of objects. Because it's an array, it must be looped over like arrays. Because the items of the array are objects you must display the properties of the object and not the object itself.

Example:

In this example, we have a list of order line items that we want to display as a table. To do this we will loop over each item in the list of line items using the #each function.

When looping over a list of objects, you can access the properties of that object directly since variables within a loop are within the context of the current item.

{{#each line_items}} {{qty}} x {{name}} @ {{$number amount "$0,0.00"}} ea. {{/each}}

{
    "line_items": [
        {
            "name": "Sample widget 1",
            "price": 50,
            "quantity": 2,
            "amount": 100
        },
        {
            "name": "Sample widget 2",
            "price": 1200,
            "quantity": 1,
            "amount": 1200
        },
        {
            "name": "Sample widget 3",
            "price": 10,
            "quantity": 50,
            "amount": 500
        }
    ]
}

2 x Sample widget 1 @ $100 ea. 1 x Sample widget 2 @ $1,200 ea. 50 x Sample widget 3 @ $10 ea.

We're using the $number formatter here to format the amount property value.

PreviousSyntaxNextFormatting

Last updated 5 months ago

Was this helpful?

You can also repeat an element for each item in an array. To learn more check out

Repeating Elements