Merge variables are the building blocks of DocuMerge. It’s how you define what values to output in your document templates, as well as to configure other settings throughout your Document and Data Routes. The values of those variables can be numbers, strings, and objects/arrays. Calling a merge variable look like this:
{$some_variable_nam
e
}
A merge variable will:
- Open with “
{
” and close with “}
“ - Contain a “
$
” directly after the open bracket “{
“ - Proceeded by the name of your variable “
some_variable_name
“
So what’s okay in variable names?
- Letters, numbers, and underscores are fine.
- Capitalization is fine, but variables are Case Sensitive when calling them.
What’s not okay?
- Don’t use spaces; instead use an underscore “
_
“. - Don’t use special characters (){}/\|!@$#%^&*,.;”‘ etc
- Don’t use hyphens in variable names. For example, defining a variable like
$new-variable
is not valid.
Any other variable considerations?
- For locally created variables, we recommend you start the name with an underscore “
_
“.
IE:{$_localVariable}
This will help you easily sperate your externally send variable data from one’s created within the DocuMerge application during processing of a merge event. - Some variable names are reserved by DocuMerge. We recommend you do not create nor send variables with this name, unless you are specifically intending to manipulate or trigger the purpose of these variables:
Reserved Variable | Purpose |
---|---|
{$combine} and {$_combine} | Triggers a multi-session merge |
{$_auto_number} | Variable created/set by Document “Auto Number“ |
{$_route_auto_number} | Variable created/set by Route “Auto Number“ |
{$_ip} | Submission IP |
{$_date} and {$_datetime} | date(‘Y-m-d’).’T’.date(‘H:i:s’)) |
To continue learning about merge variables and usage, see: