---
title: "The Variable element"
slug: "the-variable-element"
abstract: ""
---
# The Variable element

The variable element allows you to set the variable contents (variable of the type “Custom Text”). Be aware that it does not create a variable if it does not exist in the master document, it only sets the content.

To create a variable in the master document:

1. Select **Type**, **Text****Variables**, **Define** from the InDesign main menu.
2. In the Text Variables dialog click **New**.
3. Select the **Custom Text** type and enter a name that corresponds to the name value of your Find element in the XML.

    ![PXM-variable.png](https://doc.sitecore.com/api/markdown-image/xp/en/developers/print-experience-manager/images/PXM-variable.png)

    A variable can be inserted by using the InsertVar element:

    ![PXM-insertvar.png](https://doc.sitecore.com/api/markdown-image/xp/en/developers/print-experience-manager/images/PXM-insertvar.png)

    In this example, the value of the VAR_1 variable is set to “this is VAR_1”. In the content we use the “InsertVar” element to create a new variable called “VAR_3”. We then insert the variable “VAR_1”. Then we insert the “VAR_3”. Then we insert the variable “VAR_X”, which corresponds to a variable of the type “Creation date” in the master. And finally we create a new variable called “VAR_X1” and set the value of that variable to “test”. This would result in:

    ![PXM-insertvar-result.png](https://doc.sitecore.com/api/markdown-image/xp/en/developers/print-experience-manager/images/PXM-insertvar-result.png)