# Data and Variables

### What is a variable?

Variables are what Documint uses to make templates dynamic. They are used to tell Documint where in your template to place your data, when to [repeat/loop ](https://docs.documint.me/legacy-documentation/broken-reference)[page elements](https://docs.documint.me/legacy-documentation/broken-reference) over lists in your data, and to [conditionally show or hide](https://docs.documint.me/legacy-documentation/broken-reference) [page elements](https://docs.documint.me/legacy-documentation/broken-reference) based on the values in your data.

In addition to telling Documint where to place your data, there are also functions that you can use to manipulate data in your template. Here are some of the things you can do using functions:

* format [numbers](https://docs.documint.me/legacy-documentation/broken-reference), [percentages](https://docs.documint.me/legacy-documentation/broken-reference), [currencies](https://docs.documint.me/legacy-documentation/broken-reference), [dates](https://docs.documint.me/legacy-documentation/broken-reference), and [durations](https://docs.documint.me/legacy-documentation/broken-reference)
* filter a list of data
* join data from a list
* create [custom variable ](https://docs.documint.me/legacy-documentation/broken-reference)
* group data together
* properly display markdown text
* etc.

### Add a variable

To add a variable to your template click the  ‘New Variable button’ on the right-hand Data pane, enter the name of your variable in the input field,  copy the generated variable name then paste the variable into a text field. &#x20;

![](https://384378337-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MT1T1SjtsFgrrhbgucz%2F-Ma6fUu2IZVgLFw3RS7T%2F-Ma6iff1ahmi4PEWuycy%2Fvariable-add.gif?alt=media\&token=98064da9-836e-4f08-bd2d-c478fff9a15a)

{% hint style="info" %}
Don't include spaces or any special characters in your variable names
{% endhint %}

### Test Variable

When your template contains [variables](https://docs.documint.me/legacy-documentation/broken-reference) it’s important to test those variables with sample data to see what your documents will look like before you connect your template to a data source. Enter test values to the variable fields and click 'Save & refresh'

{% hint style="info" %}
If this is the first time you are using 'Preview' you will see a blank version of your template in the Preview Pane as we do below.
{% endhint %}

![](https://1903534506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTY5wPd81K7B5rjyG5tjS%2Fuploads%2FZh4B7ZqpWjRhGgxXRkgw%2Ftesting%20variables.png?alt=media\&token=0b9f8de8-81d0-4612-b599-37ec63086892)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.documint.me/legacy-documentation/data-and-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
